Divergence /
cli
| 1 | <?php |
||
| 2 | /* |
||
| 3 | * This file is part of the Divergence package. |
||
| 4 | * |
||
| 5 | * (c) Henry Paradiz <[email protected]> |
||
| 6 | * |
||
| 7 | * For the full copyright and license information, please view the LICENSE |
||
| 8 | * file that was distributed with this source code. |
||
| 9 | */ |
||
| 10 | namespace Divergence\CLI; |
||
| 11 | |||
| 12 | use Divergence\CLI\Env; |
||
| 13 | use \League\CLImate\CLImate; |
||
| 14 | use Divergence\CLI\Controllers\Commands\Basics; |
||
| 15 | use Divergence\CLI\Controllers\Commands\Config; |
||
| 16 | use Divergence\CLI\Controllers\Commands\Tester; |
||
| 17 | use Divergence\CLI\Controllers\CommandLineHandler; |
||
| 18 | |||
| 19 | use Divergence\CLI\Controllers\Commands\Initialize; |
||
| 20 | |||
| 21 | class Command extends CommandLineHandler |
||
| 22 | { |
||
| 23 | public static $climate; // instance of \League\CLImate\CLImate; |
||
| 24 | |||
| 25 | public static function getClimate() |
||
| 26 | { |
||
| 27 | return static::$climate; |
||
| 28 | } |
||
| 29 | |||
| 30 | public static function handle() |
||
| 31 | { |
||
| 32 | Env::getEnvironment(); |
||
| 33 | |||
| 34 | Env::$me = static::shiftArgs(); |
||
| 35 | |||
| 36 | static::$climate = new CLImate(); |
||
| 37 | //static::$climate->style->addCommand('orange', '38;5;208' /*'38;5;208'*/); |
||
| 38 | //static::$climate->orange('test'); exit; |
||
| 39 | |||
| 40 | switch ($action = static::shiftArgs()) { |
||
|
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
| 41 | case 'init': |
||
| 42 | Initialize::init(); |
||
| 43 | break; |
||
| 44 | |||
| 45 | case 'status': |
||
| 46 | Basics::status(); |
||
| 47 | break; |
||
| 48 | |||
| 49 | case 'config': |
||
| 50 | Config::handle(); |
||
| 51 | |||
| 52 | // no break |
||
| 53 | case 'build': |
||
| 54 | // Divergence\Controllers\Builder::handle(); |
||
| 55 | break; |
||
| 56 | |||
| 57 | case 'test': |
||
| 58 | Tester::handle(); |
||
| 59 | break; |
||
| 60 | |||
| 61 | case '-v': |
||
| 62 | case '--version': |
||
| 63 | Basics::version(); |
||
| 64 | break; |
||
| 65 | |||
| 66 | case '--help': |
||
| 67 | case '-h': |
||
| 68 | case 'help': |
||
| 69 | default: |
||
| 70 | Basics::usage(); |
||
| 71 | } |
||
| 72 | } |
||
| 73 | } |
||
| 74 |