Removed descr from command props
This commit is contained in:
parent
809c04abfa
commit
c7b1a637c2
@ -16,14 +16,10 @@ Major changes:
|
|||||||
* The event `Shell::EVT_BAD_COMMAND` will be fired if a command can
|
* The event `Shell::EVT_BAD_COMMAND` will be fired if a command can
|
||||||
not be found, assuming `Context->execute()` does not accept the
|
not be found, assuming `Context->execute()` does not accept the
|
||||||
command. (see *examples/commandevents.php*)
|
command. (see *examples/commandevents.php*)
|
||||||
* When calling `Context->addCommand()` you can now use both `help`
|
|
||||||
and `descr` as the last argument to provide the description text
|
|
||||||
for the command. This change is intended to make `addCommand` and
|
|
||||||
the doccomment `@descr` more similar.
|
|
||||||
|
|
||||||
New features:
|
New features:
|
||||||
|
|
||||||
* Tasks can now be added and removed from the shell. Tasks will receive
|
* Tasks can now be added and removed from the shell. Tasks will receive
|
||||||
a call to their `update()` method once per main loop, until they are
|
a call to their `update()` method once per main loop, until they are
|
||||||
removed or return false from the `isValid()` method. Tasks need to
|
removed or return false from the `isValid()` method. Tasks need to
|
||||||
implement the `TaskInterface` interface. (see *examples/tasks.php*)
|
implement the `TaskInterface` interface. (see *examples/tasks.php*)
|
||||||
|
@ -30,7 +30,7 @@ $myShell->setPrompt("test>");
|
|||||||
$ctx = $myShell->createContext("root");
|
$ctx = $myShell->createContext("root");
|
||||||
$ctx->addCommand("hello", function () {
|
$ctx->addCommand("hello", function () {
|
||||||
echo "Hello World!\n";
|
echo "Hello World!\n";
|
||||||
}, [ 'descr'=>'Say hello' ]);
|
}, [ 'help'=>'Say hello' ]);
|
||||||
|
|
||||||
// Run the shell
|
// Run the shell
|
||||||
$myShell->run();
|
$myShell->run();
|
||||||
|
@ -132,7 +132,6 @@ class Context
|
|||||||
$info = $this->commandInfo[$command];
|
$info = $this->commandInfo[$command];
|
||||||
$args = array_key_exists("args",$info)?$info['args']:"";
|
$args = array_key_exists("args",$info)?$info['args']:"";
|
||||||
$help = array_key_exists("help",$info)?$info['help']:"";
|
$help = array_key_exists("help",$info)?$info['help']:"";
|
||||||
$help = $help?:(array_key_exists("descr",$info)?$info['descr']:"");
|
|
||||||
$ret[trim("{$command} {$args}")] = $help;
|
$ret[trim("{$command} {$args}")] = $help;
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user