diff options
-rw-r--r-- | it.class | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -401,15 +401,19 @@ function imageconvert($p) /** - * Parse command line options with Usage given as template. Example: + * Parse command line options with Usage given as template and return assoc array. Example: (like grep --help) * Usage: myprogram.php [OPTIONS] PATTERN * -s, --short Use short ouput * -f, --file=FILE Use FILE for input * -x EXTENSION Ignore EXTENSION - * Value always stored in long opt. Use double blank before explanation. Non-option text ignored. - * Mandatory non-option arguments are stored under their lowercased name. + * Mandatory arguments from the Usage: line are returned under their (lowercased!) name. + * All non-option arguments are returned in 'args' + * Option text must be indented; if long and short option present, value is stored in long option + * Options without arguments store true or false under their key + * Options -h and --help will be handled internally by printing usage and exiting + * Two or more blanks must be in front of option explanation * @param $helplines Usage parsed to determine options - * @return Associative array of opts: Boolean options are set to true, remaining args returned in 'args' + * @return Associative array of options */ function getopt($helplines) { |