diff --git a/examples/basic.php b/examples/basic.php new file mode 100644 index 0000000..e951ddc --- /dev/null +++ b/examples/basic.php @@ -0,0 +1,12 @@ +setPrompt("test>"); +$myShell->pushContext(new Context()); +$myShell->run(); diff --git a/lib/Context.php b/lib/Context.php index ef920e7..0b1da8b 100644 --- a/lib/Context.php +++ b/lib/Context.php @@ -23,6 +23,11 @@ class Context $this->configure(); } + public function getContextInfo() + { + return null; + } + public function setShell(Shell $shell) { $this->shell = $shell; diff --git a/lib/Shell.php b/lib/Shell.php index 5833f76..da24fbb 100644 --- a/lib/Shell.php +++ b/lib/Shell.php @@ -232,11 +232,11 @@ class Shell switch ($command) { case '.': $type = basename(strtr(get_class($this->context), "\\", "/")); - printf("%s<%s>: %s\n", $type, $this->context->getName(), json_encode($this->context->getData())); + printf("%s<%s>: %s\n", $type, $this->context->getName(), $this->context->getContextInfo()); $level = 0; foreach ($this->contextStack as $context) { $type = basename(strtr(get_class($context), "\\", "/")); - printf(" %s- %s<%s>\n", str_repeat(" ",$level++), $type, $context->getName()); + printf(" %sā””ā”€%s<%s>: %s\n", str_repeat(" ",$level++), $type, $context->getName(), $context->getContextInfo()); } break; case '..':