From c2d75b17317c49873a7b4332aef7bdd03489b1ad Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Mon, 3 Oct 2016 14:46:20 +0200 Subject: support ultragetopt --- it.class | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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']) -- cgit v1.2.3