summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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'])