From b39689ae4b720951d4396f50bda896599ca1f6ec Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 29 Nov 2017 01:42:24 +0000 Subject: [PATCH] lib/php/db/shell.php --- lib/php/db/shell.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/php/db/shell.php b/lib/php/db/shell.php index cecd60b3..552e3d26 100755 --- a/lib/php/db/shell.php +++ b/lib/php/db/shell.php @@ -31,6 +31,20 @@ while($line = fgets(STDIN)){ # Exit command if ($line == 'quit' or $line == 'q') break; + # Help + if ($line == 'help' or $line == 'h') { + $line = str_repeat('-',20)."\n"; + echo $line . trim(" +help,h +quit,q +db=[NAME] +table=[NAME] +action,a=[ls,reset] + ")."\n" . $line; + + continue; + } + # Set params while ($line and (0 or preg_match("/^([\w\.]+)='([^']+)'/",$line,$args) @@ -66,6 +80,10 @@ function db_shell_action($k,$v) { break; } + if (empty($Db)) { + echo "Database is missing, try help\n"; + break; + } #bye($Db::p()); if ($Db->p('debug') == 'shell') { debug($Db->p()); -- 2.47.3