]> git.xonotic.org Git - xonotic/xonotic.git/blob - misc/tools/all/zsh_autocompletion/all/_all
7cd8ec2e924aaf0bda353af3ed0a12639aeceeee
[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 if one does not exist yet'
23     {checkout,switch}':checkout a specific branch in repos where it exists and default branch elsewhere'
24     'branch:create a branch in a repo (asks for 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                 "-1[don't compile d0_blind_id]" \
55                 '-c[clean all before building]' \
56                 '-qc[clean QuakeC binaries]' \
57                 - '(release)' \
58                     '-r[build in release mode]' \
59                 - '(profile)' \
60                     '-p[build in profile mode]' && ret=0
61             ;;
62
63         compile-map)
64             _files -W "(data/xonotic-maps.pk3dir/maps)" -g "*.map(:r)" && ret=0
65             ;;
66
67         clean)
68             _arguments \
69                 - '(noreclone)' \
70                     '-f[force clean]' \
71                     '-u[go to upstream]' \
72                     '-U[go to upstream and fetch master]' \
73                     '-m[go to master]' \
74                     '-r[remove untracked files]' \
75                     '-D[kill branches]' \
76                 - '(reclone)' \
77                     '--reclone[set all the other flags (effectively a reclone)]' && ret=0
78             ;;
79
80         update|pull)
81             _arguments \
82                 "-N[reset git config for each repo]" \
83                 '-l[find the best mirror in the specified location]' \
84                 - '(ssh)' \
85                     {-p,-s}'[set ssh as push protocol and find the best mirror]' \
86                 - '(git)' \
87                     '-g[set git as push protocol and find the best mirror]' \
88                 - '(http)' \
89                     '-h[set http as push protocol and find the best mirror]' && ret=0
90             ;;
91
92         esac
93         ;;
94 esac
95
96 return ret