blob: a120a76fd0b4da4e774105eef9271bfa0ce17bbb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# Autocompletion for bash.
_pwclient() {
local cur prev words cword split
if declare -f _init_completion >/dev/null; then
_init_completion -s || return
else
cur=$(_get_cword)
prev=${COMP_WORDS[COMP_CWORD-1]}
fi
case "${COMP_CWORD}" in
0|1) return 0;;
esac
projects="$(sed -r -e '/\[options\]/d;' \
-e '/^\[(.+)\]$/!d;' \
-e 's//\1/;' ~/.pwclientrc 2>/dev/null)"
case "${prev}" in
-p) COMPREPLY=( $(compgen -W "${projects}" -- "${cur}" ) );;
esac
return 0
}
complete -F _pwclient pwclient
# vim: ft=sh
|