From e5b328b822e8a42f77f4d1e12d275b07aa311a8c Mon Sep 17 00:00:00 2001 From: Christopher Vagnetoft Date: Fri, 27 Jan 2017 04:30:50 +0100 Subject: [PATCH] Spiced up the help --- lib/Shell.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/Shell.php b/lib/Shell.php index fdedc3b..51f3d09 100644 --- a/lib/Shell.php +++ b/lib/Shell.php @@ -407,19 +407,25 @@ class Shell } } ksort($ghelp); - printf("Commands in current context:\n"); + printf("\e[1mCommands:\e[0m\n"); foreach ($help as $command=>$info) { - printf(" %-20s %s\n", $command, $info); + if (strpos($command," ")!==false) { + list($command,$args) = explode(" ",$command,2); + } else $args=null; + $command = sprintf("\e[97m%s \e[90m%s\e[0m", $command,$args); + printf(" %s - \e[3;36m%s\e[0m\n", $command, $info); } if (count($ghelp)) { - printf("\nImported from parent contexts:\n"); - foreach ($ghelp as $command=>$info) { - printf(" %-20s %s\n", $command, $info); - } + printf("\n\e[0mCommands from parent contexts:\e[0m\n"); + if (strpos($command," ")!==false) { + list($command,$args) = explode(" ",$command,2); + } else $args=null; + $command = sprintf("\e[97m%s \e[90m%s\e[0m", $command,$args); + printf(" %s - \e[3;36m%s\e[0m\n", $command, $info); } printf("\nGlobal commands:\n"); - printf(" %-20s %s\n", "exit", "Leave the shell"); - printf(" %-20s %s\n", "..", "Discard the current context and go to parent"); + printf(" \e[97m%s\e[0;36;3m - %s\e[0m\n", "exit", "Leave the shell"); + printf(" \e[97m%s\e[0;36;3m - %s\e[0m\n", "..", "Discard the current context and go to parent"); break; case 'exit': $this->stop();