| Conditions | 3 |
| Paths | 1 |
| Total Lines | 26 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | #!/usr/bin/php |
||
| 14 | public function setup(): Cmd { |
||
| 15 | return Cmd::root() |
||
| 16 | ->addParam('v|verbose', [ |
||
| 17 | 'description' => 'Flag to enable verbose output' |
||
| 18 | ]) |
||
| 19 | ->addParam('n|name:', [ |
||
| 20 | 'description' => 'Name parameter. This param requires a value.', |
||
| 21 | 'isa' => 'string', |
||
| 22 | 'default' => 'World' |
||
| 23 | ]) |
||
| 24 | ->setCallable(static function (Cmd $cmd) { |
||
| 25 | |||
| 26 | $name = $cmd->options->get('name'); |
||
| 27 | |||
| 28 | self::eol(); |
||
| 29 | self::echo(sprintf('Hello %s', $name), Color::FOREGROUND_COLOR_YELLOW); |
||
| 30 | self::eol(); |
||
| 31 | |||
| 32 | if($cmd->options->has('verbose')) { |
||
| 33 | $keys = array_keys($cmd->options->keys); |
||
| 34 | self::eol(); |
||
| 35 | self::echo('All option params...', Color::FOREGROUND_COLOR_GREEN); |
||
| 36 | foreach($keys as $k) { |
||
| 37 | self::echo(self::PADDING . $k . ': ' . $cmd->options->get($k), Color::FOREGROUND_COLOR_GREEN); |
||
| 38 | } |
||
| 39 | self::eol(); |
||
| 40 | } |
||
| 47 |