The Bash Argsparse Library 1.8
An high level argument parsing library for bash.
Functions
Misc Functions.

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...
 

Detailed Description

Function Documentation

◆ __argsparse_has_array_item()

__argsparse_has_array_item ( array_name  ,
item   
)
Parameters
array_namean array name.
iteman item key.
Return values
0if an array has been already declared by the name of the parameter AND if said array holds given key.

◆ __argsparse_index_of()

__argsparse_index_of ( value  ,
values...   
)

Tells if a value is found in a set of other values.

Parameters
valuea value
values...array values

Look for value and print its position in the values set. Return false if it can not be found.

Return values
0if value is amongst values
1if value is not found.

◆ __argsparse_is_array_declared()

__argsparse_is_array_declared ( name  )
Parameters
nameA potential array name
Return values
0if an array named after the parameter does exist

◆ __argsparse_join_array()

__argsparse_join_array ( ,
strings...   
)

join multiple strings by a char.

Parameters
ca 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.

Return values
1if first parameter is invalid.
0else.

◆ __argsparse_values_array_identifier()

__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.

Parameters
optionan option name.
Return values
1if array has not been declared
0else. Array name will be written to stdout.

◆ argsparse_option_to_identifier()

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.

Parameters
optionan option name.