The . builtin command now shows the stack too

This commit is contained in:
Chris 2016-11-01 15:45:54 +01:00
parent bb74b56fc4
commit 01ee043bac
1 changed files with 5 additions and 2 deletions

View File

@ -199,8 +199,11 @@ class Shell
{ {
switch ($command) { switch ($command) {
case '.': case '.':
printf("context<%s>:\n", $this->context->getName()); printf("context<%s>: %s\n", $this->context->getName(), json_encode($this->context->getData()));
echo " ".join("\n ",explode("\n",json_encode($this->context->getData(),JSON_PRETTY_PRINT)))."\n"; $level = 0;
foreach ($this->contextStack as $context) {
printf(" %s- context<%s>\n", str_repeat(" ",$level++), $context->getName());
}
break; break;
case '..': case '..':
if (count($this->contextStack)>0) if (count($this->contextStack)>0)