diff options
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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']) |