Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 685c920

Browse files
committed
Add the ability to change the help text for commands
1 parent bcac3b9 commit 685c920

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
@@ -69,6 +69,16 @@ public function setHelp($help)
6969
$this->setup['']['help'] = $help;
7070
}
7171

72+
/**
73+
* Sets the help text for the tools commands itself
74+
*
75+
* @param string $help
76+
*/
77+
public function setCommandHelp($help)
78+
{
79+
$this->setup['']['commandhelp'] = $help;
80+
}
81+
7282
/**
7383
* Register the names of arguments for help generation and number checking
7484
*
@@ -334,6 +344,8 @@ public function help()
334344
$text = '';
335345

336346
$hascommands = (count($this->setup) > 1);
347+
$commandhelp = $this->setup[""]["commandhelp"]
348+
?: 'This tool accepts a command as first parameter as outlined below:';
337349
foreach ($this->setup as $command => $config) {
338350
$hasopts = (bool)$this->setup[$command]['opts'];
339351
$hasargs = (bool)$this->setup[$command]['args'];
@@ -433,7 +445,7 @@ public function help()
433445
$text .= "\n";
434446
$text .= $tf->format(
435447
array($mv, '*'),
436-
array('', 'This tool accepts a command as first parameter as outlined below:')
448+
array('', $commandhelp)
437449
);
438450
$text .= "\n";
439451
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /