Modernize bash-completion

Use _init_completion
Support long options with or without =
Auto generate options from the --help using _parse_help
This commit is contained in:
Nirgal Vourgère
2020-10-27 00:05:26 +01:00
parent 58f240ac6f
commit 9e50c7401d
12 changed files with 93 additions and 157 deletions

View File

@@ -1,13 +1,12 @@
#-*- mode: shell-script;-*-
_mdb_ver()
{
local cur
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
local cur prev words cword
_init_completion || return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-M -h --help' -- $cur ) )
COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
#COMPREPLY=($(compgen -W '--help --mdbtools' -- "$cur"))
else
_filedir '@(mdb|mdw|accdb)'
fi