| 1 |
# bash completion for augtool -*- shell-script -*- |
| 2 |
|
| 3 |
_augmatch() |
| 4 |
{ |
| 5 |
local cur prev words cword |
| 6 |
_init_completion || return |
| 7 |
|
| 8 |
case $prev in |
| 9 |
--help | -!(-*)[h]) |
| 10 |
return |
| 11 |
;; |
| 12 |
--lens | -!(-*)[l]) |
| 13 |
local lenses |
| 14 |
lenses="$(augtool --noload 'match /augeas/load/*/lens' | sed -e 's/.*@//')" |
| 15 |
COMPREPLY=($(compgen -W "${lenses,,}" -- "${cur,,}")) |
| 16 |
return |
| 17 |
;; |
| 18 |
--root | --include | -!(-*)[rI]) |
| 19 |
_filedir -d |
| 20 |
return |
| 21 |
;; |
| 22 |
esac |
| 23 |
|
| 24 |
if [[ "$cur" == -* ]]; then |
| 25 |
local opts="$(_parse_help "$1")" |
| 26 |
COMPREPLY=($(compgen -W '${opts:-$(_parse_help "$1")}' -- "$cur")) |
| 27 |
else |
| 28 |
_filedir |
| 29 |
fi |
| 30 |
} && |
| 31 |
complete -F _augmatch augmatch |
| 32 |
|
| 33 |
# ex: filetype=sh |