From: Nicolas Boisselier Date: Tue, 2 Aug 2016 23:05:52 +0000 (+0100) Subject: help X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=ba8e5b436a3dc497f0606afc88edf3b624f3041a;p=nb.git help --- diff --git a/lib/php/db.php b/lib/php/db.php index 0269eea2..bafa3bf5 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -356,6 +356,22 @@ class Db extends nb { } public function action($action,$table=null) { + $available = [ + ['(db.)?help','This help'], + ['(db.)?dbs','List databases from conf'], + #['(db.)?dbs','List databases (name=* type=* all=1)'], + ['(db.)?tables','List tables (name=* type=* count=1 engine=*)'], + + ['(table.)?rows','Dump one table, use format='], + ['(table.)?fields','List fields'], + ['table.infos','Table infos (count(*). Type, ...)'], + ['table.sql','Get the sql source'], + + ['(table.)?insert','Insert a record'], + ['(table.)?update','Update a record'], + ['(table.)?delete','Delete a record'], + + ]; $actions = explode(',',$action); $this->pdef('format',($this->php_cli() ? 'csv' : '')); $rows = array(); @@ -364,21 +380,7 @@ class Db extends nb { foreach($actions as $action) { if ($action == 'db.help' or $action == 'help') { - $this->out(array( - array('[db.]help','This help'), - array('[db.]dbs','List databases'), - array('[db.]tables','List tables'), - - array('[table.]rows','Dump one table, use format='), - array('[table.]fields','List fields'), - array('table.infos','Table infos (count(*). Type, ...)'), - array('table.sql','Get the sql source'), - - array('[table.]insert','Insert a record'), - array('[table.]update','Update a record'), - array('[table.]delete','Delete a record'), - - ),array('action','description')); + $this->out($available,['action','description']); $return = true; } elseif ($action == 'db.tables' or $action == 'tables') { @@ -403,9 +405,9 @@ class Db extends nb { $return = $this->out(array_values($this->conf)); } elseif ($action == 'db.dbs' or $action == 'dbs') { - if (self::p('hash') or self::p('all')) { + if (true or self::p('hash') or self::p('all')) { - $fields = ['id','name','host','type']; + $fields = ['name','title','type','host']; $dbs = []; $name = self::p('name',''); $type = self::p('type','');