|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of Bowerphp. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Massimiliano Arione <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Bowerphp\Command; |
|
13
|
|
|
|
|
14
|
|
|
use Symfony\Component\Console\Command\HelpCommand as SymfonyHelpCommand; |
|
15
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
|
16
|
|
|
use Symfony\Component\Console\Input\InputOption; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* This is just an extension of original HelpCommand, needed to remove the last line from help. |
|
20
|
|
|
* See also {@link https://github.com/Bee-Lab/bowerphp/issues/108}. |
|
21
|
|
|
*/ |
|
22
|
|
|
class HelpCommand extends SymfonyHelpCommand |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* {@inheritdoc} |
|
26
|
|
|
*/ |
|
27
|
|
|
protected function configure() |
|
28
|
|
|
{ |
|
29
|
|
|
$this->ignoreValidationErrors(); |
|
30
|
|
|
|
|
31
|
|
|
$this |
|
32
|
|
|
->setName('help') |
|
33
|
|
|
->setDefinition([ |
|
34
|
|
|
new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'), |
|
35
|
|
|
new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'), |
|
36
|
|
|
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'), |
|
37
|
|
|
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'), |
|
38
|
|
|
]) |
|
39
|
|
|
->setDescription('Displays help for a command') |
|
40
|
|
|
->setHelp(<<<'EOF' |
|
41
|
|
|
The <info>%command.name%</info> command displays help for a given command: |
|
42
|
|
|
|
|
43
|
|
|
<info>php %command.full_name% list</info> |
|
44
|
|
|
|
|
45
|
|
|
You can also output the help in other formats by using the <comment>--format</comment> option: |
|
46
|
|
|
|
|
47
|
|
|
<info>php %command.full_name% --format=xml list</info> |
|
48
|
|
|
EOF |
|
49
|
|
|
) |
|
50
|
|
|
; |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|