The Bash Argsparse Library 1.8
An high level argument parsing library for bash.
Loading...
Searching...
No Matches
Setting options values.

Functions

 __argsparse_set_option (option)
 Resolv option-specific setter function and invoke it.
 
 argsparse_are_environment_variables_enabled ()
 Tell if option setting through environment variables is enabled or not.
 
 argsparse_get_cumulative_array_name (option)
 Print the name of the array used for "cumulative" and "cumulativeset" options.
 
 argsparse_set_alias (option)
 "alias" property specific option-setting hook.
 
 argsparse_set_cumulative_option (option, value)
 "cumulative" property specific option-setting hook.
 
 argsparse_set_cumulativeset_option (option, value)
 "cumulativeset" property specific option-setting hook.
 
 argsparse_set_option (option, value)
 Default option-setting hook.
 
 argsparse_set_option_with_value (option, value)
 "value" property specific option-setting hook.
 
 argsparse_set_option_without_value (option)
 The option-setting hook for options not accepting values.
 
 argsparse_use_environment_variables (prefix)
 Enable option setting through environment variables.
 

Variables

String __argsparse_environment_variable_prefix
 The prefix for option-setting environment variables.
 

Detailed Description

Function Documentation

◆ __argsparse_set_option()

__argsparse_set_option ( option )

Resolv option-specific setter function and invoke it.

Check if a user-defined option setting function (set_option_<optionname>) has been defined or if the generic argsparse_set_option() function is to be used. Then invoke the that function with the option name as first parameter. If a value for the option is involved, it is passed as a second parameter.

Parameters
optionan option name.
Returns
the setter function return code

◆ argsparse_are_environment_variables_enabled()

argsparse_are_environment_variables_enabled ( )

Tell if option setting through environment variables is enabled or not.

Return values
0if argsparse_parse_options would also retrieve option values from environment variables. @

◆ argsparse_get_cumulative_array_name()

argsparse_get_cumulative_array_name ( option )

Print the name of the array used for "cumulative" and "cumulativeset" options.

Parameters
optionan option name.

For "option-name" usually prints "cumulated_values_option_name".

◆ argsparse_set_alias()

argsparse_set_alias ( option )

"alias" property specific option-setting hook.

Parameters
optionan option name.

When an option is an alias for other option(s), then set the aliases options.

◆ argsparse_set_cumulative_option()

argsparse_set_cumulative_option ( option ,
value  )

"cumulative" property specific option-setting hook.

Default action to take for cumulative options. Store value into an array whose name is generated using argsparse_get_cumulative_array_name().

Parameters
optionan option name.
valuethe value put on command line for given option.

◆ argsparse_set_cumulativeset_option()

argsparse_set_cumulativeset_option ( option ,
value  )

"cumulativeset" property specific option-setting hook.

Parameters
optionan option name.
valuea new value for the option.

Default action to take for cumulativeset options. Act exactly like argsparse_set_cumulative_option() except that values are not duplicated in the cumulated values array.

◆ argsparse_set_option()

argsparse_set_option ( option ,
value  )

Default option-setting hook.

Parameters
optionThe option being set.
valuethe value of the option (optional).

This function will be called by argsparse_parse_options() whenever a given option is being set and no custom setting hook is defined for said option. Depending of the properties of the option, a more specific setting hook will be called.

◆ argsparse_set_option_with_value()

argsparse_set_option_with_value ( option ,
value  )

"value" property specific option-setting hook.

Parameters
optionan option name.
valuethe value put on command line for given option.

◆ argsparse_set_option_without_value()

argsparse_set_option_without_value ( option )

The option-setting hook for options not accepting values.

Parameters
optionan option name.
Return values
0

◆ argsparse_use_environment_variables()

argsparse_use_environment_variables ( prefix )

Enable option setting through environment variables.

Once enabled, it cannot be disabled.

Parameters
prefixan environment variable prefix