-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrcon.bashcomp.sh
More file actions
35 lines (28 loc) · 795 Bytes
/
rcon.bashcomp.sh
File metadata and controls
35 lines (28 loc) · 795 Bytes
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
# rcon bash completion
_rcon()
{
local cur prev words cword split
_init_completion || return
lngopts="--config --help --host --port --password --server --1packet"
shtopts="-c -H -h -p -P -s -1"
configfile="$HOME/.rconrc"
case "${prev}" in
-c|--config)
_filedir
return
;;
-H|--host)
_known_hosts_real "$cur"
return
;;
-s|--server)
servers=$(egrep "^\s*\\[.*?\\]" "${configfile}" 2>/dev/null | tr -d '[]')
COMPREPLY=( $(compgen -W '"${servers}"' -- "$cur") )
return
;;
esac
if [[ $cur == -* ]]; then
COMPREPLY=( $(compgen -W '$("$1" --help | _parse_help -)' -- "$cur") )
fi
} &&
complete -F _rcon rcon