]> git.xonotic.org Git - xonotic/xonotic.git/blob - misc/tools/all/zsh_autocompletion/all/_all
Add zsh autocompletion for the all script
[xonotic/xonotic.git] / misc / tools / all / zsh_autocompletion / all / _all
1 #compdef all
2
3 zstyle ":completion:*:descriptions" format "%B%d%b"
4
5
6 local context state line ret=1
7 typeset -A opt_args
8
9
10 local -a _1st_arguments
11 _1st_arguments=(
12     'help:print the help message'
13     {update,pull}':update all repos'
14     'compile:compile the source code'
15     'clean:clean all repos'
16     'run:run the game'
17     'update-maps:download the latest version of all official maps from the autobuild server'
18     'compile-map:compile the specified maps'
19     'serverbench:run the server benchmark'
20     'fix_upstream_rebase:fix upstream rebase'
21     'fix_config:fix .git/config'
22     'keygen:generate ssh key for repo access'
23     {checkout,switch}':checkout a specific branch'
24     'branch:create a branch in a repo'
25     {push,commit}':commit and push changes'
26     {each,foreach}':run a command in each repo'
27     'grep:run "git grep" in all repos'
28 )
29
30 _arguments -C \
31     '1: :->cmds' \
32     '*:: :->args' && ret=0
33
34
35 case $state in
36     cmds)
37         _describe -t actions 'commands' _1st_arguments
38         ret=0
39         ;;
40
41     args)
42         case $words[1] in
43         run)
44             # choose version and autocomplete cvars
45             # possible TODO: check for OS and adapt to it
46             _arguments \
47                 '1:Version:(sdl glx dedicated)' && ret=0
48             ;;
49
50         compile)
51             _arguments \
52                 '1:Version:(sdl glx dedicated)' \
53                 "-0[don't use precompiled d0_blind_id]" \
54                 '-c[clean all before building]' \
55                 '-qc[clean QuakeC binaries]' \
56                 - '(release)' \
57                     '-r[build in release mode]' \
58                 - '(profile)' \
59                     '-p[build in profile mode]' && ret=0
60             ;;
61
62         compile-map)
63             _files -W "(data/xonotic-maps.pk3dir/maps)" -g "*.map(:r)" && ret=0
64             ;;
65
66         clean)
67             _arguments \
68                 - '(noreclone)' \
69                     '-f[force clean]' \
70                     '-u[go to upstream]' \
71                     '-U[go to upstream and fetch master]' \
72                     '-m[go to master]' \
73                     '-r[remove untracked files]' \
74                     '-D[kill branches]' \
75                 - '(reclone)' \
76                     '--reclone[set all the other flags (effectively a reclone)]' && ret=0
77             ;;
78
79         update|pull)
80             _arguments \
81                 "-N[don't allow pull]" \
82                 '-l[find the best mirror in the specified location]' \
83                 - '(ssh)' \
84                     {-p,-s}'[set ssh as push protocol and find the best mirror]' \
85                 - '(git)' \
86                     '-g[set git as push protocol and find the best mirror]' \
87                 - '(http)' \
88                     '-h[set http as push protocol and find the best mirror]' && ret=0
89             ;;
90
91         esac
92         ;;
93 esac
94
95 return ret