forked from platformsh/legacy-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into development
- v4.18.1
- v4.18.0
- v4.17.0
- v4.16.0
- v4.15.3
- v4.15.2
- v4.15.1
- v4.15.0
- v4.14.2
- v4.14.1
- v4.14.0
- v4.13.1
- v4.13.0
- v4.12.1
- v4.12.0
- v4.11.5
- v4.11.4
- v4.11.3
- v4.11.2
- v4.11.1
- v4.11.0
- v4.10.4
- v4.10.3
- v4.10.2
- v4.10.1
- v4.10.0
- v4.9.0
- v4.8.6
- v4.8.5
- v4.8.4
- v4.8.3
- v4.8.2
- v4.8.1
- v4.8.0
- v4.7.2
- v4.7.1
- v4.7.0
- v4.6.1
- v4.6.0
- v4.5.0
- v4.4.1
- v4.4.0
- v4.3.0
- v4.2.1
- v4.2.0
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.2
- v4.0.1
- v4.0.0
- v3.88.1
- v3.88.0
- v3.87.1
- v3.87.0
- v3.86.1
- v3.86.0
- v3.85.0
- v3.84.2
- v3.84.1
- v3.84.0
- v3.83.1
- v3.83.0
- v3.82.2
- v3.82.1
- v3.82.0
- v3.81.1
- v3.81.0
- v3.80.3
- v3.80.2
- v3.80.1
- v3.80.0
- v3.79.8
- v3.79.7
- v3.79.6
- v3.79.5
- v3.79.4
- v3.79.3
- v3.79.2
- v3.79.1
- v3.79.0
- v3.78.0
- v3.77.0
- v3.76.2
- v3.76.1
- v3.76.0
- v3.75.3
- v3.75.2
- v3.75.1
- v3.75.0
- v3.74.0
- v3.73.2
- v3.73.1
- v3.73.0
- v3.72.2
- v3.72.1
- v3.72.0
- v3.71.0
- v3.70.1
- v3.70.0
- v3.69.2
- v3.69.1
- v3.69.0
- v3.69.0-dev-organizations-16
- v3.69.0-dev-organizations-15
- v3.68.0
- v3.68.0-dev-organizations-14
- v3.68.0-dev-organizations-13
- v3.68.0-dev-organizations-12
- v3.68.0-dev-organizations-11
- v3.68.0-dev-organizations-10
- v3.68.0-dev-organizations-9
- v3.68.0-dev-organizations-8
- v3.68.0-dev-organizations-7
- v3.68.0-dev-organizations-6
- v3.68.0-dev-organizations-5
- v3.68.0-dev-organizations-4
- v3.68.0-dev-organizations-3
- v3.68.0-dev-organizations-2
- v3.68.0-dev-organizations
- v3.67.6
- v3.67.5
- v3.67.4
- v3.67.3
- v3.67.2
- v3.67.1
- v3.67.0
- v3.66.4
- v3.66.3
- v3.66.2
- v3.66.1
- v3.66.0
- v3.65.4
- v3.65.3
- v3.65.2
- v3.65.1
- v3.65.0
- v3.64.6
- v3.64.5
- v3.64.4
- v3.64.3
- v3.64.2
- v3.64.1
- v3.64.0
- v3.63.3
- v3.63.2
- v3.63.1
- v3.63.0
- v3.62.6
- v3.62.5
- v3.62.4
- v3.62.3
- v3.62.2
- v3.62.1
- v3.62.0
- v3.61.0
- v3.60.4
- v3.60.3
- v3.60.2
- v3.60.1
- v3.60.0
- v3.59.1
- v3.59.0
- v3.58.0
- v3.57.6
- v3.57.5
- v3.57.4
- v3.57.3
- v3.57.2
- v3.57.1
- v3.57.0
- v3.56.6
- v3.56.5
- v3.56.4
- v3.56.3
- v3.56.2
- v3.56.1
- v3.56.0
- v3.55.0
- v3.54.2
- v3.54.1
- v3.54.0
- v3.53.1
- v3.53.0
- v3.52.3
- v3.52.2
- v0.0.26
Showing
9 changed files
with
211 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
░░░░░░░░░░░░░░░░░░░░░░░ | ||
░░░░░░███░░░░░███░░░░░░ | ||
░░░░░░█ █░░░░░█ █░░░░░░ | ||
░░░░░░█ █░░░░░█ █░░░░░░ | ||
░░░░░░███░░░░░███░░░░░░ | ||
░░░░░░░░░░░░░░░░░░░░░░░ | ||
░░██████░░███░░██████░░ | ||
░░░░░░░░░░░█░░░░░░░░░░░ | ||
░░██████░░█░█░░██████░░ | ||
░░░░░░░░░░░░░░░░░░░░░░░ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
░░░░░░░░░░░░░░░░░░░░░░░ | ||
░░░░░░███░░░░░███░░░░░░ | ||
░░░░░░█ █░░░░░█ █░░░░░░ | ||
░░░░░░█ █░░░░░█ █░░░░░░ | ||
░░░░░░███░░░░░███░░░░░░ | ||
░░░░░░░░░░░░░░░░░░░░░░░ | ||
░░██████░░███░░██████░░ | ||
░░░░░░░░░░█░█░░░░░░░░░░ | ||
░░██████░░░░░░░██████░░ | ||
░░░░░░░░░░░░░░░░░░░░░░░ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
░░░░░░░░░░░░░░░░░░░░░░░ | ||
░░░░░░░░░░░░░░███░░░░░░ | ||
░░░░░░░░░░░░░░█ █░░░░░░ | ||
░░░░░░███░░░░░█ █░░░░░░ | ||
░░░░░░███░░░░░███░░░░░░ | ||
░░░░░░░░░░░░░░░░░░░░░░░ | ||
░░██████░░███░░██████░░ | ||
░░░░░░░░░░░█░░░░░░░░░░░ | ||
░░██████░░█░█░░██████░░ | ||
░░░░░░░░░░░░░░░░░░░░░░░ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Platformsh\Cli\Command; | ||
|
||
use Platformsh\Cli\Console\Winky; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class WinkyCommand extends CommandBase | ||
{ | ||
protected $hiddenInList = true; | ||
protected $local = true; | ||
|
||
protected function configure() | ||
{ | ||
$this->setName('winky'); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$winky = new Winky($output, $this->config()->get('service.name')); | ||
|
||
if (!$output->isDecorated()) { | ||
$winky->render(); | ||
return; | ||
} | ||
|
||
while (true) { | ||
$winky->render(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Platformsh\Cli\Console; | ||
|
||
class AnimationFrame | ||
{ | ||
private $content; | ||
private $duration = 500000; | ||
|
||
public function __construct($content, $duration = 50000) | ||
{ | ||
$this->content = $content; | ||
$this->duration = $duration; | ||
} | ||
|
||
public function getDuration() | ||
{ | ||
return $this->duration; | ||
} | ||
|
||
public function __toString() | ||
{ | ||
return $this->content; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace Platformsh\Cli\Console; | ||
|
||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class Winky extends Animation | ||
{ | ||
/** | ||
* @param OutputInterface $output | ||
* @param string $signature | ||
*/ | ||
public function __construct(OutputInterface $output, $signature = '') | ||
{ | ||
$dir = CLI_ROOT . '/resources/winky'; | ||
|
||
$sources = []; | ||
$sources['normal'] = file_get_contents($dir . '/normal'); | ||
$sources['wink'] = file_get_contents($dir . '/wink'); | ||
$sources['twitch'] = file_get_contents($dir . '/twitch'); | ||
|
||
list($firstLine,) = explode("\n", trim($sources['normal']), 2); | ||
$width = mb_strlen($firstLine); | ||
|
||
// Replace Unicode characters with ANSI background colors. | ||
if ($output->isDecorated()) { | ||
foreach ($sources as &$source) { | ||
$source = preg_replace_callback('/([\x{2588}\x{2591} ])\1*/u', function (array $matches) { | ||
$styles = [ | ||
' ' => "\033[47m", | ||
'█' => "\033[40m", | ||
'░' => "\033[48;5;217m", | ||
]; | ||
$char = mb_substr($matches[0], 0, 1); | ||
|
||
return $styles[$char] . str_repeat(' ', mb_strlen($matches[0])) . "\033[0m"; | ||
}, $source); | ||
} | ||
} | ||
|
||
// Add the indent and signature. | ||
$indent = ' '; | ||
if (strlen($signature) > 0) { | ||
$signatureIndent = str_repeat(' ', strlen($indent) + floor($width / 2) - floor(strlen($signature) / 2)); | ||
$signature = "\n" . $signatureIndent . $signature; | ||
} | ||
$sources = array_map(function ($source) use ($indent, $signature) { | ||
return "\n" . preg_replace('/^/m', $indent, $source) . $signature . "\n"; | ||
}, $sources); | ||
|
||
$frames = []; | ||
$frames[] = new AnimationFrame($sources['normal'], 1200000); | ||
$frames[] = new AnimationFrame($sources['wink'], 200000); | ||
$frames[] = new AnimationFrame($sources['normal'], 1200000); | ||
$frames[] = new AnimationFrame($sources['twitch'], 150000); | ||
|
||
parent::__construct($output, $frames); | ||
} | ||
} |