Improved context commands
This commit is contained in:
@ -4,6 +4,7 @@ require_once __DIR__."/../vendor/autoload.php";
|
||||
|
||||
use NoccyLabs\Shell\Shell;
|
||||
use NoccyLabs\Shell\Command;
|
||||
use NoccyLabs\Shell\Context;
|
||||
|
||||
class MyCommand extends Command
|
||||
{
|
||||
@ -13,6 +14,18 @@ class MyCommand extends Command
|
||||
}
|
||||
}
|
||||
|
||||
class MyContext extends Context
|
||||
{
|
||||
/**
|
||||
* @args
|
||||
* @help Useful test!
|
||||
*/
|
||||
public function test()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class MyShell extends Shell
|
||||
{
|
||||
|
||||
@ -20,7 +33,8 @@ class MyShell extends Shell
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$context = $this->createContext();
|
||||
$context = new MyContext();
|
||||
$this->pushContext($context);
|
||||
$context->addCommand("hello", function () {
|
||||
echo "world\nthis\nis\na\ntest\n";
|
||||
});
|
||||
|
Reference in New Issue
Block a user