-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_completion_zsh_compliant
52 lines (47 loc) · 1.92 KB
/
.bash_completion_zsh_compliant
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
# wrench bash auto-completion zsh proof
# Last updated for wrench v2.01 (20151115)
# Add this text to your ~/.bash_completion file.
# Be sure to set APPDIR, SQLDBFILE, and SQLCMD exactly as they are in wrench.
_wrench()
{
local cur prev opts base APPDIR SQLDBFILE SQLCMD LIST_INSTALLS
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="autocleanup autoupdate bootstart console delink install list listplayers lockdown-master rcon reconfig relink rename restart restartnow setup showconfig start status stop stopall stopnow uninstall unlock-master cleanup update updatenow update-validate update-validatenow gametype"
# APPDIR, SQLDBFILE, and SQLCMD should be the same as what is set in wrench. Change here as needed.
APPDIR=~/srcds
SQLDBFILE=$APPDIR/wrench.db
alias SQLCMD="sqlite3 -batch -list -noheader $SQLDBFILE"
case "${prev}" in
# All installation types.
showconfig|reconfig|rename|rcon)
local LIST_INSTALLS="$(SQLCMD "select INSTALLID from inst;")"
COMPREPLY=( $(compgen -W "${LIST_INSTALLS}" -- ${cur}) )
return 0
;;
# Runnable installation types (linked and standalone).
start|stop|stopnow|restart|restartnow|console|status|relink|delink|cleanup)
local LIST_RUNNABLE="$(SQLCMD "select INSTALLID from inst where INSTTYPE='linked' or INSTTYPE='standalone';")"
COMPREPLY=( $(compgen -W "${LIST_RUNNABLE}" -- ${cur}) )
return 0
;;
# Master installation types.
lockdown-master|unlock-master|update|updatenow|update-validate|update-validatenow)
local LIST_MASTERS="$(SQLCMD "select INSTALLID from inst where INSTTYPE='master';")"
COMPREPLY=( $(compgen -W "${LIST_MASTERS}" -- ${cur}) )
return 0
;;
# Game type actions.
gametype)
local LIST_GAMETYPE_ACTIONS="add change delete"
COMPREPLY=( $(compgen -W "${LIST_GAMETYPE_ACTIONS}" -- ${cur}) )
return 0
;;
*)
;;
esac
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
return 0
}
complete -F _wrench wrench