Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
206 additions
and
20 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,60 @@ | ||
<?php | ||
|
||
/** | ||
* JBZoo Toolbox - Cli | ||
* | ||
* This file is part of the JBZoo Toolbox project. | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Cli | ||
* @license MIT | ||
* @copyright Copyright (C) JBZoo.com, All rights reserved. | ||
* @link https://github.com/JBZoo/Cli | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DemoApp\Commands; | ||
|
||
use JBZoo\Cli\CliCommand; | ||
use JBZoo\Cli\CliRender; | ||
use JBZoo\Cli\Codes; | ||
|
||
use function JBZoo\Cli\cli; | ||
|
||
/** | ||
* Class ExamplesHelpers | ||
*/ | ||
class ExamplesHelpers extends CliCommand | ||
{ | ||
protected function configure(): void | ||
{ | ||
$this | ||
->setName('examples:helpers') | ||
->setDescription('Examples of new CLI helpers'); | ||
|
||
parent::configure(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
protected function executeAction(): int | ||
{ | ||
$yourName = $this->ask("What's your name?", 'idk'); | ||
cli("Your name is \"{$yourName}\""); | ||
|
||
$yourSecret = $this->askPassword("New password?"); | ||
cli("Your secret is \"{$yourSecret}\""); | ||
|
||
$selectedColor = $this->askOption('Choose your favorite color', ['Red', 'Blue', 'Yellow'], 1); | ||
$colorAlias = strtolower($selectedColor); | ||
cli("Selected color is \"<{$colorAlias}>{$selectedColor}</{$colorAlias}>\""); | ||
|
||
$isConfirmed = $this->confirmation('Are you ready to execute the script?'); | ||
cli("Is confirmed: " . ($isConfirmed ? 'Yes' : 'No')); | ||
|
||
return self::SUCCESS; | ||
} | ||
} |
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
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
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
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
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