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

@ -210,11 +210,14 @@ class Shell
$this->popContext();
break;
case 'help':
echo
"Built in commands:\n".
" . Show current context\n".
" .. Go to parent context\n".
" exit Exit the shell\n";
$help = $this->context->getCommandHelp();
printf("Commands in current context:\n\n");
foreach ($help as $command=>$info) {
printf(" %-20s %s\n", $command, $info);
}
printf("\nGlobal commands:\n\n");
printf(" %-20s %s\n", "exit", "Leave the shell");
printf(" %-20s %s\n", "..", "Discard the current context and go to parent");
break;
case 'exit':
$this->stop();