From af95946defdab4411df6c696f3bf5847dd5b3b42 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Mon, 23 May 2016 19:35:17 +0000 Subject: [PATCH] cli : add a "-q" option to not display the return code git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2730 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- cli.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cli.php b/cli.php index efdf6fd..b4f2b06 100644 --- a/cli.php +++ b/cli.php @@ -13,8 +13,12 @@ class cli require ("domframework/cli.php"); $cli = new cli; $cli->run(); */ + /** The expert mode allow to see/execute the models */ private $EXPERT = false; + /** Quiet mode don't display empty results */ + private $QUIET; + public function __construct () { // Catch the trigger_errors and display them politely @@ -90,6 +94,13 @@ class cli exit; } + $this->QUIET = FALSE; + if (isset ($argv[0]) && $argv[0] === "-q") + { + $this->QUIET = true; + array_shift ($argv); + } + $this->EXPERT = FALSE; if (isset ($argv[0]) && $argv[0] === "-expert") { @@ -346,7 +357,8 @@ class cli $r = $classReflection->newInstanceArgs($paramConst); $r->auth["email"] = "cli"; $s = call_user_func_array(array($r, $method), $argv); - var_dump ($s); + if ($this->QUIET === false || $s !== "" && $s !== array () && $s !== null) + var_dump ($s); } catch (Exception $e) {