The Bash Argsparse Library 1.8
An high level argument parsing library for bash.
|
Functions | |
__argsparse_compgen (param...) | |
A compgen wrapper. More... | |
__argsparse_complete () | |
Completion for the command stored in ${words[0]}. More... | |
__argsparse_complete_get_long (word, long...) | |
Find the option we want to complete. More... | |
__argsparse_complete_value (option) | |
Complete the value an option. More... | |
_argsparse_complete () | |
The argsparse completion function. More... | |
__argsparse_compgen | ( | param... | ) |
A compgen wrapper.
This function will just call compgen with given argument, safely adding $cur in the command line. Also if compgen_prefix is set, a -P option will be provided to compgen.
param... | any set of compgen options |
__argsparse_complete | ( | ) |
Completion for the command stored in ${words[0]}.
Will load the script to complete, and invoke compgen according to context.
non-zero | if completed command cannot be sourced. |
__argsparse_complete_get_long | ( | word | , |
long... | |||
) |
Find the option we want to complete.
If given word parameter is a recognized option, print the matching long option name. Also if "$cur" should be this option value, then return 0.
word | any word. |
long... | a list of long options. |
0 | if given word matches an option and if that option accepts a value. |
__argsparse_complete_value | ( | option | ) |
Complete the value an option.
Run compgen with values matching given option. If an array "option_<optionname>_values" exists, complete with its values. Else if option has a type, complete values according to type when possible. Else do nothing.
option | a long option name. |
_argsparse_complete | ( | ) |
The argsparse completion function.
To enable completion on a script that uses the argsparse library, call the "complete" built-in as following: