Compare commits

...

2 Commits

Author SHA1 Message Date
Chris 08ab24d665 Bugfixes to help command 2017-01-30 12:10:23 +01:00
Chris fdd1814875 Moved onEnter event 2017-01-29 20:31:04 +01:00
1 changed files with 9 additions and 6 deletions

View File

@ -113,8 +113,8 @@ class Shell
} }
$context->setShell($this); $context->setShell($this);
$this->context = $context; $this->context = $context;
$context->onEnter();
$this->dispatchEvent(self::EVT_CONTEXT_CHANGED); $this->dispatchEvent(self::EVT_CONTEXT_CHANGED);
$context->onEnter();
} }
/** /**
@ -429,11 +429,14 @@ class Shell
$_($command, $args,$info); $_($command, $args,$info);
} }
if (count($ghelp)) { if (count($ghelp)) {
printf("\e[1mCommands from parent contexts:\e[0m\n"); foreach ($ghelp as $command=>$info) {
if (strpos($command," ")!==false) { printf("\e[1mCommands from parent contexts:\e[0m\n");
list($command,$args) = explode(" ",$command,2); if (strpos($command," ")!==false) {
} else $args=null; list($command,$args) = explode(" ",$command,2);
$_($command, $args,$info); } else $args=null;
if (!array_key_exists($command,$ghelp)) continue;
$_($command, $args,$info);
}
} }
printf("\e[1mGlobal commands:\e[0m\n"); printf("\e[1mGlobal commands:\e[0m\n");
$_("exit", null, "Leave the shell"); $_("exit", null, "Leave the shell");