CLI: command completions in bash, bash-like shells
This commit is contained in:
parent
8a6d766b06
commit
ba6921c91d
24
bash/command-completion
Normal file
24
bash/command-completion
Normal file
@ -0,0 +1,24 @@
|
||||
_gramps()
|
||||
{
|
||||
local cur prev opts
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
opts="--action --config --create --databases --debug --export --format --help --import --open --options --quiet --remove --show --usage --version --yes -? -C -L -O -a -b -c -d -e -f -i -l -p -q -r -s -t -u -v -y"
|
||||
if [[ ${cur} == -* ]] ; then
|
||||
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
||||
return 0
|
||||
elif [[ ${cur} == --open ]] ; then
|
||||
local IFS=$'\n'
|
||||
local names=($( ./Gramps.py -l | grep \" | cut -d\ -f4- ))
|
||||
COMPREPLY=( $(compgen --W "${names[*]}" -- ${cur}) )
|
||||
return 0
|
||||
else
|
||||
local IFS=$'\n'
|
||||
local names=($( ./Gramps.py -l | grep \" | cut -d\ -f4- ))
|
||||
COMPREPLY=( $(compgen -W "${names[*]}" -- ${cur}) )
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
complete -F _gramps gramps
|
||||
complete -F _gramps ./Gramps.py
|
Loading…
Reference in New Issue
Block a user