|
The Bash Argsparse Library
1.8
An high level argument parsing library for bash.
|
Bash Argsparse Library. More...
Functions | |
| __argsparse_parse_options_valuecheck (option, value) | |
| Check a value given to an option. More... | |
| __argsparse_values_array_identifier (option) | |
| Prints the name of the array containing all user-declared acceptable values for an option. More... | |
| argsparse_allow_no_argument (string) | |
| Allow empty command lines to run. More... | |
| argsparse_check_option_type (type, value) | |
| Check if a value matches a given type. More... | |
| argsparse_describe_parameters (param...) | |
| Describe non-option positionnal parameters. More... | |
| argsparse_get_cumulative_array_name (option) | |
| Print the name of the array used for "cumulative" and "cumulativeset" options. More... | |
| argsparse_maximum_parameters (unsigned_int) | |
| Set the maximum number of non-option parameters expected on the command line. More... | |
| argsparse_minimum_parameters (unsigned_int) | |
| Set the minimum number of non-option parameters expected on the command line. More... | |
| argsparse_option_to_identifier (option) | |
| Give the identifier name associated to an option. More... | |
| argsparse_set_alias (option) | |
| "alias" property specific option-setting hook. More... | |
| argsparse_set_cumulative_option (option, value) | |
| "cumulative" property specific option-setting hook. More... | |
| argsparse_set_cumulativeset_option (option, value) | |
| "cumulativeset" property specific option-setting hook. More... | |
| argsparse_set_option (option, value) | |
| Default option-setting hook. More... | |
| argsparse_set_option_with_value (option, value) | |
| "value" property specific option-setting hook. More... | |
| argsparse_set_option_without_value (option) | |
| The option-setting hook for options not accepting values. More... | |
| argsparse_usage () | |
| A generic help message generated from the options and their descriptions. More... | |
| argsparse_usage_long () | |
| Fully describe the program syntax and options to the end-user. More... | |
| argsparse_usage_short () | |
| Print a short description of the program syntax. More... | |
| set_option_help () | |
| Default trigger for –help option. More... | |
| usage () | |
| Default usage function. More... | |
Variables | |
| Integer | __argsparse_maximum_parameters = 1000000 |
| Internal use only. More... | |
| Integer | __argsparse_minimum_parameters = 0 |
| Internal use only. More... | |
| String AssociativeArray | __argsparse_options_default_values |
| Internal use only. More... | |
| String AssociativeArray | __argsparse_options_descriptions |
| Internal use only. | |
| String Array | __argsparse_parameters_description |
| Internal use only. | |
| ReadOnly String | argsparse_pgm |
| The name of the program currently using argsparse. More... | |
| String | argsparse_usage_description |
| Usage description additionnal string. More... | |
| ReadOnly String | ARGSPARSE_VERSION = 1.8 |
| argsparse version number | |
Bash Argsparse Library.
| __argsparse_parse_options_valuecheck | ( | option | , |
| value | |||
| ) |
Check a value given to an option.
If an enumeration has been defined for the option, check against that. If there's no enumeration, but option has a type property, then check against the type. In the end, check against check_value_of_<option> function, if it's been defined.
| option | an option name. |
| value | anything. |
| 0 | if value is correct for given option. |
| __argsparse_values_array_identifier | ( | option | ) |
Prints the name of the array containing all user-declared acceptable values for an option.
from "opt" or "opt-name" string, prints "option_opt_values[@]" or "option_opt_name_values[@]", unless array is not declared, in which case function will return an error.
| option | an option name. |
| 1 | if array has not been declared |
| 0 | else. Array name will be written to stdout. |
| argsparse_allow_no_argument | ( | string | ) |
Allow empty command lines to run.
Change argsparse behaviour for empty command lines. Default says "no argument triggers usage".
| string | if (case-insensitive) "yes", "true" or "1", the value is considered as affirmative. Anything else is a negative value. |
| 0 | unless there's more than one parameter (or none). |
| argsparse_check_option_type | ( | type | , |
| value | |||
| ) |
Check if a value matches a given type.
Return True if value is of type type.
| type | A case-insensitive type name. |
| value | a value to check. |
| 0 | if the value matches the given type format. |
| argsparse_describe_parameters | ( | param... | ) |
Describe non-option positionnal parameters.
This function has currently 2 purposes:
| param... | a list of label describing positionnal parameters. These labels can have special forms such as:
|
| 0 |
| argsparse_get_cumulative_array_name | ( | option | ) |
Print the name of the array used for "cumulative" and "cumulativeset" options.
| option | an option name. |
For "option-name" usually prints "cumulated_values_option_name".
| argsparse_option_to_identifier | ( | option | ) |
Give the identifier name associated to an option.
Transforms and prints an option name into a string which suitable to be part of a function or a variable name.
| option | an option name. |
| ReadOnly String argsparse_pgm |
The name of the program currently using argsparse.
Automatically set by argsparse at load time, it contains the basename (path-less but with extension, if any) of the main script. Used internally to print error messages and by usage-related functions, but can be used by the loading script.
1.8.14