The Bash Argsparse Library 1.8
An high level argument parsing library for bash.
|
Functions | |
__argsparse_has_array_item (array_name, item) | |
__argsparse_index_of (value, values...) | |
Tells if a value is found in a set of other values. More... | |
__argsparse_is_array_declared (name) | |
__argsparse_join_array (c, strings...) | |
join multiple strings by a char. More... | |
__argsparse_values_array_identifier (option) | |
Prints the name of the array containing all user-declared acceptable values for an option. More... | |
argsparse_option_to_identifier (option) | |
Give the identifier name associated to an option. More... | |
__argsparse_has_array_item | ( | array_name | , |
item | |||
) |
array_name | an array name. |
item | an item key. |
0 | if an array has been already declared by the name of the parameter AND if said array holds given key. |
__argsparse_index_of | ( | value | , |
values... | |||
) |
Tells if a value is found in a set of other values.
value | a value |
values... | array values |
Look for value and print its position in the values set. Return false if it can not be found.
0 | if value is amongst values |
1 | if value is not found. |
__argsparse_is_array_declared | ( | name | ) |
name | A potential array name |
0 | if an array named after the parameter does exist |
__argsparse_join_array | ( | c | , |
strings... | |||
) |
join multiple strings by a char.
c | a single char |
strings... | strings to join |
Like the 'str.join' string method in python, join multiple strings by a char. Only work with a single char, though.
1 | if first parameter is invalid. |
0 | else. |
__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_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. |