diff options
author | kate.ward <kate.ward@forestent.com> | 2008-11-14 00:46:44 +0000 |
---|---|---|
committer | kate.ward <kate.ward@forestent.com> | 2008-11-14 00:46:44 +0000 |
commit | 18d456e403ccc5989edc7f8cf1d83ca18425e4a8 (patch) | |
tree | d4c6a1be330fd27d2ca2c4390dcc623e1de2a2ea /source/1.0/src | |
parent | cc1456880ce111c6efc2c217030e783729bb0131 (diff) | |
download | shflags-18d456e403ccc5989edc7f8cf1d83ca18425e4a8.tar.gz |
worked on some function header documentation
Diffstat (limited to 'source/1.0/src')
-rw-r--r-- | source/1.0/src/shflags | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/source/1.0/src/shflags b/source/1.0/src/shflags index 3f4d837..689f564 100644 --- a/source/1.0/src/shflags +++ b/source/1.0/src/shflags @@ -446,11 +446,11 @@ _flags_itemInList() # # Args: # str: string: string to determine length of -# Returns: +# Output: # integer: length of string _flags_strlen() { - echo "$1" |wc -c |awk '{print $1}' + echo "$1" |awk '{print length($0)}' } # Validate a boolean. @@ -474,7 +474,7 @@ _flags_validateBoolean() return ${flags_return} } -# validate a float +# Validate a float. # # Args: # _flags__float: float: value to validate @@ -503,7 +503,7 @@ _flags_validateFloat() return ${flags_return} } -# validate an integer +# Validate an integer. # # Args: # _flags__integer: interger: value to validate @@ -528,6 +528,15 @@ _flags_validateInteger() return ${flags_return} } +# Parse command-line options using the standard getopt. +# +# Note: the flag options are passed around in the global __flags_opts so that +# the formatting is not lost due to shell parsing and such. +# +# Args: +# @: varies: command-line options to parse +# Returns: +# integer: a FLAGS success condition _flags_standardGetopt() { flags_return=${FLAGS_TRUE} @@ -557,6 +566,15 @@ _flags_standardGetopt() return ${flags_return} } +# Parse command-line options using the enhanced getopt. +# +# Note: the flag options are passed around in the global __flags_opts so that +# the formatting is not lost due to shell parsing and such. +# +# Args: +# @: varies: command-line options to parse +# Returns: +# integer: a FLAGS success condition _flags_enhancedGetopt() { flags_return=${FLAGS_TRUE} @@ -579,6 +597,16 @@ _flags_enhancedGetopt() return ${flags_return} } +# Dynamically parse a getopt result and set appropriate variables. +# +# This function does the actual conversion of getopt output and runs it through +# the standard case structure for parsing. The case structure is actually quite +# dynamic to support any number of flags. +# +# Args: +# @: varies: output from getopt parsing +# Returns: +# integer: a FLAGS success condition _flags_parseGetopt() { FLAGS_ARGC=0 |