-
Notifications
You must be signed in to change notification settings - Fork 0
/
terrariad.completion
96 lines (88 loc) · 3.02 KB
/
terrariad.completion
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
_terrariad() {
TERRARIAD="$1"
COMPREPLY=()
COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
OPTS="
start stop force-stop restart force-restart backup status list ls send attach create update update-mods enable disable quickstart
list-worlds-all list-worlds-running list-worlds-startable list-worlds-servertype list-worlds-enabled list-worlds-disabled
"
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=($(compgen -W "$OPTS" -- ${COMP_WORDS[COMP_CWORD]}))
elif [ $COMP_CWORD -eq 2 ]; then
case ${COMP_WORDS[COMP_CWORD-1]} in
start)
OPTIONS=$($TERRARIAD list-worlds-startable)
COMPREPLY=($(compgen -W "$OPTIONS" -- ${COMP_WORDS[COMP_CWORD]}))
;;
stop|force-stop|restart|force-restart|send|attach)
OPTIONS=$($TERRARIAD list-worlds-running)
COMPREPLY=($(compgen -W "$OPTIONS" -- ${COMP_WORDS[COMP_CWORD]}))
;;
backup|status|list|ls)
OPTIONS=$($TERRARIAD list-worlds-all)
COMPREPLY=($(compgen -W "$OPTIONS" -- ${COMP_WORDS[COMP_CWORD]}))
;;
update-mods)
OPTIONS=$($TERRARIAD list-worlds-servertype "tmodloader")
COMPREPLY=($(compgen -W "$OPTIONS" -- ${COMP_WORDS[COMP_CWORD]}))
;;
list-worlds-servertype)
OPTIONS="vanilla tmodloader"
COMPREPLY=($(compgen -W "$OPTIONS" -- ${COMP_WORDS[COMP_CWORD]}))
;;
enable)
OPTIONS=$($TERRARIAD list-worlds-disabled)
COMPREPLY=($(compgen -W "$OPTIONS" -- ${COMP_WORDS[COMP_CWORD]}))
;;
disable)
OPTIONS=$($TERRARIAD list-worlds-enabled)
COMPREPLY=($(compgen -W "$OPTIONS" -- ${COMP_WORDS[COMP_CWORD]}))
;;
quickstart)
OPTIONS="create remove"
COMPREPLY=($(compgen -W "$OPTIONS" -- ${COMP_WORDS[COMP_CWORD]}))
;;
esac
elif [ $COMP_CWORD -eq 3 ]; then
case ${COMP_WORDS[COMP_CWORD-2]} in
create)
OPTIONS="vanilla tmodloader"
COMPREPLY=($(compgen -W "$OPTIONS" -- ${COMP_WORDS[COMP_CWORD]}))
;;
quickstart)
if [ ${COMP_WORDS[COMP_CWORD-1]} = "create" ]; then
OPTIONS=$($TERRARIAD list-worlds-all)
COMPREPLY=($(compgen -W "$OPTIONS" -- ${COMP_WORDS[COMP_CWORD]}))
fi
;;
esac
elif [ $COMP_CWORD -eq 4 ]; then
case ${COMP_WORDS[COMP_CWORD-3]} in
create)
OPTIONS="1 2 3"
COMPREPLY=($(compgen -W "$OPTIONS" -- ${COMP_WORDS[COMP_CWORD]}))
;;
quickstart)
if [ ${COMP_WORDS[COMP_CWORD-2]} = "create" ]; then
OPTIONS="1 2 3"
COMPREPLY=($(compgen -W "$OPTIONS" -- ${COMP_WORDS[COMP_CWORD]}))
fi
;;
esac
elif [ $COMP_CWORD -eq 5 ]; then
case ${COMP_WORDS[COMP_CWORD-4]} in
create)
OPTIONS="0 1"
COMPREPLY=($(compgen -W "$OPTIONS" -- ${COMP_WORDS[COMP_CWORD]}))
;;
quickstart)
if [ ${COMP_WORDS[COMP_CWORD-3]} = "create" ]; then
OPTIONS="0 1"
COMPREPLY=($(compgen -W "$OPTIONS" -- ${COMP_WORDS[COMP_CWORD]}))
fi
;;
esac
fi
return 0
}
complete -F _terrariad terrariad