Ejemplo n.º 1
0
Archivo: app.php Proyecto: demental/m
 public static function factory($command, $path = 'M/commands/')
 {
     $path = APP_ROOT . 'app/' . APP_NAME . '/commands/';
     return parent::factory($command, $path);
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
-4
Archivo: help.php Proyecto: 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();
         }
     }
 }