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
This commit is contained in:
2016-05-23 19:35:17 +00:00
parent b403cb41ea
commit af95946def

14
cli.php
View File

@@ -13,8 +13,12 @@ class cli
require ("domframework/cli.php"); require ("domframework/cli.php");
$cli = new cli; $cli = new cli;
$cli->run(); */ $cli->run(); */
/** The expert mode allow to see/execute the models */
private $EXPERT = false; private $EXPERT = false;
/** Quiet mode don't display empty results */
private $QUIET;
public function __construct () public function __construct ()
{ {
// Catch the trigger_errors and display them politely // Catch the trigger_errors and display them politely
@@ -90,6 +94,13 @@ class cli
exit; exit;
} }
$this->QUIET = FALSE;
if (isset ($argv[0]) && $argv[0] === "-q")
{
$this->QUIET = true;
array_shift ($argv);
}
$this->EXPERT = FALSE; $this->EXPERT = FALSE;
if (isset ($argv[0]) && $argv[0] === "-expert") if (isset ($argv[0]) && $argv[0] === "-expert")
{ {
@@ -346,7 +357,8 @@ class cli
$r = $classReflection->newInstanceArgs($paramConst); $r = $classReflection->newInstanceArgs($paramConst);
$r->auth["email"] = "cli"; $r->auth["email"] = "cli";
$s = call_user_func_array(array($r, $method), $argv); $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) catch (Exception $e)
{ {