Exemplo n.º 1
0
 /**
  * show documentation; use "pake help taskname" to see detailed documentation on task
  *
  * @param string $task
  * @param string $args
  * @throws pakeException
  * @author Alexey Zakhlestin
  */
 public static function run_help($task, $args)
 {
     if (count($args) == 0) {
         self::get_instance()->help();
         return;
     }
     $victim_name = $args[0];
     $task_name = pakeTask::taskname_from_abbreviation($victim_name);
     $victim = null;
     foreach (pakeTask::get_tasks() as $name => $task) {
         if ($task_name == $name or $task_name == pakeTask::get_mini_task_name($name)) {
             $victim = $task;
             break;
         }
     }
     if (null === $victim) {
         throw new pakeException("Couldn't find documentation for {$task_name}");
     }
     $title = 'Documentation for "' . $task_name . '" task';
     pake_echo($title);
     pake_echo(str_repeat('=', mb_strlen($title)));
     pake_echo($victim->get_comment() . "\n");
     pake_echo($victim->get_help());
 }