Skip to content

Commit 8b32e26

Browse files
committed
Merge branch 'pr/8'
* pr/8: Add the ability to change the help text for commands
2 parents 11a3e20 + 685c920 commit 8b32e26

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Options.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ public function setHelp($help)
7777
$this->setup['']['help'] = $help;
7878
}
7979

80+
/**
81+
* Sets the help text for the tools commands itself
82+
*
83+
* @param string $help
84+
*/
85+
public function setCommandHelp($help)
86+
{
87+
$this->setup['']['commandhelp'] = $help;
88+
}
89+
8090
/**
8191
* Register the names of arguments for help generation and number checking
8292
*
@@ -342,6 +352,8 @@ public function help()
342352
$text = '';
343353

344354
$hascommands = (count($this->setup) > 1);
355+
$commandhelp = $this->setup[""]["commandhelp"]
356+
?: 'This tool accepts a command as first parameter as outlined below:';
345357
foreach ($this->setup as $command => $config) {
346358
$hasopts = (bool)$this->setup[$command]['opts'];
347359
$hasargs = (bool)$this->setup[$command]['args'];
@@ -441,7 +453,7 @@ public function help()
441453
$text .= "\n";
442454
$text .= $tf->format(
443455
array($mv, '*'),
444-
array('', 'This tool accepts a command as first parameter as outlined below:')
456+
array('', $commandhelp)
445457
);
446458
$text .= "\n";
447459
}

0 commit comments

Comments
 (0)