summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2007-10-01 13:32:17 +0000
committerUrban Müller2007-10-01 13:32:17 +0000
commit77300bbcab173f3187b6ea1bbe8be7150c2288f8 (patch)
tree9481407ea4ef0e8988c25239b271deb8eba299ce
parent6b4c65126f1ae474b409e491be4ae163e239124d (diff)
downloaditools-77300bbcab173f3187b6ea1bbe8be7150c2288f8.tar.gz
itools-77300bbcab173f3187b6ea1bbe8be7150c2288f8.tar.bz2
itools-77300bbcab173f3187b6ea1bbe8be7150c2288f8.zip
getopt documentation
-rw-r--r--it.class12
1 files changed, 8 insertions, 4 deletions
diff --git a/it.class b/it.class
index 0092e86..3db36c1 100644
--- a/it.class
+++ b/it.class
@@ -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)
{