pakeApp::run_help PHP Method

run_help() public static method

show documentation; use "pake help taskname" to see detailed documentation on task
Author: Alexey Zakhlestin
public static run_help ( string $task, string $args )
$task string
$args string
    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());
    }