Tweaks to help styling

This commit is contained in:
Chris 2017-01-27 04:36:23 +01:00
parent e5b328b822
commit ff9845e23e

View File

@ -407,25 +407,27 @@ class Shell
} }
} }
ksort($ghelp); ksort($ghelp);
$_ = function($command,$args,$info) {
printf(" \e[97m%s\e[0m \e[90;3m%s\e[0m - \e[36m%s\e[0m\n", $command, $args, $info);
};
printf("\e[1mCommands:\e[0m\n"); printf("\e[1mCommands:\e[0m\n");
foreach ($help as $command=>$info) { foreach ($help as $command=>$info) {
if (strpos($command," ")!==false) { if (strpos($command," ")!==false) {
list($command,$args) = explode(" ",$command,2); list($command,$args) = explode(" ",$command,2);
} else $args=null; } else $args=null;
$command = sprintf("\e[97m%s \e[90m%s\e[0m", $command,$args); $_($command, $args,$info);
printf(" %s - \e[3;36m%s\e[0m\n", $command, $info);
} }
if (count($ghelp)) { if (count($ghelp)) {
printf("\n\e[0mCommands from parent contexts:\e[0m\n"); printf("\n\e[0mCommands from parent contexts:\e[0m\n");
if (strpos($command," ")!==false) { if (strpos($command," ")!==false) {
list($command,$args) = explode(" ",$command,2); list($command,$args) = explode(" ",$command,2);
} else $args=null; } else $args=null;
$command = sprintf("\e[97m%s \e[90m%s\e[0m", $command,$args); $_($command, $args,$info);
printf(" %s - \e[3;36m%s\e[0m\n", $command, $info);
} }
printf("\nGlobal commands:\n"); printf("\nGlobal commands:\n");
printf(" \e[97m%s\e[0;36;3m - %s\e[0m\n", "exit", "Leave the shell"); $_("exit", null, "Leave the shell");
printf(" \e[97m%s\e[0;36;3m - %s\e[0m\n", "..", "Discard the current context and go to parent"); $_(".", null, "Show the context tree");
$_("..", null, "Discard the current context and go to parent");
break; break;
case 'exit': case 'exit':
$this->stop(); $this->stop();