forked from pattern-lab/patternlab-php-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHelpCommand.php
More file actions
45 lines (32 loc) · 1.04 KB
/
HelpCommand.php
File metadata and controls
45 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/*!
* Console Help Command Class
*
* Copyright (c) 2014 Dave Olsen, http://dmolsen.com
* Licensed under the MIT license
*
*/
namespace PatternLab\Console\Commands;
use \PatternLab\Console;
use \PatternLab\Console\Command;
use \PatternLab\Timer;
class HelpCommand extends Command {
public function __construct() {
parent::__construct();
$this->command = "help:";
Console::setCommand($this->command,"Print the help for a given command","The help command prints out the help for a given flag. Just use -h with another command and it will tell you all of the options.","h:");
Console::setCommandSample($this->command,"To get help for a particular command:","<command-name>");
}
public function run() {
if ($helpCommand = Console::findCommandValue("h|help")) {
$helpCommand = str_replace("-","",$helpCommand);
if ($commandFound = Console::findCommandLong($helpCommand)) {
Console::writeHelpCommand($commandFound);
} else {
Console::writeHelp();
}
} else {
Console::writeHelp();
}
}
}