php-shell/examples/errors.php

20 lines
375 B
PHP
Raw Normal View History

2017-01-22 22:22:13 +00:00
<?php
require_once __DIR__."/../vendor/autoload.php";
use NoccyLabs\Shell\Shell;
use NoccyLabs\Shell\Context;
class CatchAllContext extends Context
{
public function execute($cmd, ...$arg)
{
throw new \Exception("Uh-oh! Error!");
}
}
$myShell = new Shell();
$myShell->setPrompt("test>");
$myShell->pushContext(new CatchAllContext());
$myShell->run();