summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2016-10-03 14:46:20 +0200
committerUrban Müller2016-10-03 14:46:20 +0200
commitc2d75b17317c49873a7b4332aef7bdd03489b1ad (patch)
tree4fa6c71b4fe9dd5e8b40ab4b5d1d22fc7fb9020f
parent86be744386d1b2b7ecb3dee7cf4274bd1a4ea9f0 (diff)
downloaditools-c2d75b17317c49873a7b4332aef7bdd03489b1ad.tar.gz
itools-c2d75b17317c49873a7b4332aef7bdd03489b1ad.tar.bz2
itools-c2d75b17317c49873a7b4332aef7bdd03489b1ad.zip
support ultragetopt
-rw-r--r--it.class3
1 files changed, 2 insertions, 1 deletions
diff --git a/it.class b/it.class
index 7e32c4b..34eeefc 100644
--- a/it.class
+++ b/it.class
@@ -727,6 +727,7 @@ static function imageconvert($p)
* Parse command line options with Usage given as template and return assoc array.
* @param $usage Usage parsed to determine options, example see below.
* @param $p['optbeforearg'] Stop parsing options when first argument is encountered
+ * @param $p['noexit'] Just return false in case of help or bad usage
* @return Associative array of options, key 'args' for optional non-option args
*
* Usage: myprogram.php [OPTIONS] PATTERN [MOREARGS]
@@ -840,7 +841,7 @@ static function getopt($usage, $p = array())
if ($err || $eat || $result['h'] || $result['help'] || $mandatoryargs)
{
fputs(($result['h'] || $result['help'] ? STDOUT : STDERR), trim($usage) . "\n");
- exit(1);
+ return $p['noexit'] ? false : exit(1);
}
if ($result['debug'])