-
Notifications
You must be signed in to change notification settings - Fork 4
/
nmm-server.bc.in
53 lines (45 loc) · 1.12 KB
/
nmm-server.bc.in
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
_nmm-server() {
local cur prev opts
COMPREPLY=( )
cur=$(_get_cword)
prev="${COMP_WORDS[COMP_CWORD-1]}"
# COMPREPLY considers '=' as a word. For $prev we prefer the word before the actual "="
if [[ "$prev" == "=" ]]
then
prev="${COMP_WORDS[COMP_CWORD - 2]}"
elif [[ "$cur" == "=" ]]
then
cur=""
fi
opts=`@bindir@/nmm-server --usage | _parse_usage -`
case "${prev}" in
--bind)
_ip_addresses
_known_hosts_real "$cur"
COMPREPLY+=" "
return 0
;;
--iface)
_available_interfaces
COMPREPLY+=" "
return 0
;;
--group)
_allowed_groups
COMPREPLY+=" "
return 0
;;
--user)
_allowed_users
COMPREPLY+=" "
return 0
;;
--ace-round)
COMPREPLY=( $(compgen -W "ACE QUEEN KING" -- ${cur}) )
COMPREPLY+=" "
return 0
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
}
complete -o nospace -F _nmm-server nmm-server