From: Nicolas Boisselier Date: Wed, 29 Nov 2017 01:42:24 +0000 (+0000) Subject: lib/php/db/shell.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=b39689ae4b720951d4396f50bda896599ca1f6ec;p=nb.git lib/php/db/shell.php --- 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());