コード例 #1
0
ファイル: app.php プロジェクト: demental/m
 public static function factory($command, $path = 'M/commands/')
 {
     $path = APP_ROOT . 'app/' . APP_NAME . '/commands/';
     return parent::factory($command, $path);
 }
コード例 #2
0
ファイル: CommandTest.php プロジェクト: kamermans/command
 public function testDurationFloat()
 {
     $delay = 1;
     $command = Command::factory("sleep")->argument($delay)->run();
     $duration = $command->getDuration(true);
     $this->assertInternalType('float', $duration);
     $this->assertGreaterThanOrEqual(0.9, $duration);
 }
コード例 #3
-4
ファイル: help.php プロジェクト: demental/m
 public function execute($params)
 {
     if (is_array($params) && count($params) > 0) {
         $command = array_shift($params);
         $exec = Command::factory($command);
         $exec->longHelp($params);
     } else {
         $this->line('This command displays global help text or specific help text for a command if provided');
         $this->line('Usage:');
         $this->line('help');
         $this->line('  Displays this help');
         $this->line('help [COMMAND_NAME]');
         $this->line('  Displays specific and longer help for [COMMAND_NAME]');
         $this->line('help [COMMAND_NAME] [SUBCOMMAND_NAME] and so on....');
         $this->line('  Displays specific and longer help for [SUBCOMMAND_NAME] if [COMMAND_NAME] contains some subcommands (e.g. the plugin command)');
         $this->line('==========');
         $this->line('Here is the list of available root commands:');
         $dir = dirname(realpath(__FILE__));
         foreach (FileUtils::getAllFiles($dir, 'php') as $afile) {
             $subcname = basename($afile, '.php');
             $subc = Command::factory($subcname);
             $this->line('====== ' . $subcname . ' ======');
             $subc->shortHelp();
         }
     }
 }