Commit a060e7cb authored by Manfred Kutas's avatar Manfred Kutas

ZP-1291 Exit with 0 if z-push-admin called with help.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 1ecfcba2
......@@ -52,6 +52,9 @@ require_once 'vendor/autoload.php';
fwrite(STDERR, ZPushAdminCLI::GetErrorMessage() . "\n");
echo ZPushAdminCLI::UsageInstructions();
if (ZPushAdminCLI::$help) {
exit(0);
}
exit(1);
}
......@@ -101,6 +104,8 @@ class ZPushAdminCLI {
static private $folderid = false;
static private $flags = 0;
static public $help = false;
/**
* Returns usage instructions
*
......@@ -172,7 +177,7 @@ class ZPushAdminCLI {
if (self::$errormessage)
return;
$options = getopt("u:d:a:t:sn:o:f:g::", array('user:', 'device:', 'action:', 'type:', 'days-old:', 'days-ago:', 'shared', 'foldername:', 'store', 'folderid:', 'flags::'));
$options = getopt("u:d:a:t:sn:o:f:g::h", array('user:', 'device:', 'action:', 'type:', 'days-old:', 'days-ago:', 'shared', 'foldername:', 'store', 'folderid:', 'flags::', 'help'));
// get 'user'
if (isset($options['u']) && !empty($options['u']))
......@@ -269,6 +274,11 @@ class ZPushAdminCLI {
}
}
if ((isset($options['h']) || isset($options['help'])) && $action === false) {
self::$help = true;
$action = 'help';
}
// get a command for the requested action
switch ($action) {
// list data
......@@ -381,8 +391,12 @@ class ZPushAdminCLI {
self::$command = self::COMMAND_REMOVESHARED;
break;
case "help":
break;
default:
self::UsageInstructions();
self::$help = false;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment