Improved context commands

This commit is contained in:
2016-11-01 16:10:35 +01:00
parent 01ee043bac
commit ae17abb6c1
3 changed files with 69 additions and 7 deletions

View File

@ -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";
});