blob: 99cfb695b29dfefb0915771ac3d3e54406f5e6b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# TODO: Add completion for each admin mode
_bcfg2-admin() {
local cur prev sedcmd possibles
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
sedcmd='sed -n -e s/^[[:space:]][[:space:]][[:space:]]\([[:alpha:]]\+\)[[:space:]]\+.*$/\1/p'
if [[ ${COMP_CWORD} -eq 1 ]] || [[ -n "${prev}" && ${prev} == -* ]]
then
possibles="$(bcfg2-admin help | ${sedcmd})"
#elif bcfg2-admin ${prev} help &>/dev/null ; then
# possibles=$(bcfg2-admin ${prev} help | ${sedcmd})
fi
[[ -n "${possibles}" ]] && \
COMPREPLY=( $(compgen -W "${possibles}" -- ${cur}) )
return 0
}
complete -F _bcfg2-admin bcfg2-admin
|