5
5
# -S means there are no options after a -- and that argument is ignored
7
7
# To use this you must arrange for it to be in a directory that is on
8
# your $fpath, and also for compinit to be run. I don't understand
9
# how to get zsh to reload this file when it changes, other than by
12
local _bzr_subcommands expl curcontext="$curcontext" state line
13
local bzrRoot helpArgs parentFile
16
helpArgs=( '(--help)-h[show help message]' '(-h)--help[show help message]' )
17
bzrRoot=$(bzr root 2> /dev/null)
18
parentFile=$bzrRoot/.bzr/parent
20
if [[ $service == "bzr" ]]; then
21
_arguments -C -A "-*" \
22
'*::command:->subcmd' && return 0
24
if (( CURRENT == 1 )); then
25
_bzr_subcommands=(${(f)"$(_call_program bzr bzr shell-complete)"})
26
_describe -t subcommand 'subcommand' _bzr_subcommands
31
curcontext="${curcontext%:*}=$service:"
36
fileList=(${(ps:\0:)"$(bzr ls --null --unknown)"})
43
fileList=(${(ps:\0:)"$(bzr ls --null --from-root --unknown)"})
50
fileList=(${(ps:\0:)"$(bzr ls --null --versioned)"})
57
_arguments $helpArgs \
58
'--no-recurse[do not recurse into subdirectories]' \
61
'*:unknown files:_unknownFiles'
64
(annotate|praise|blame)
65
_arguments $helpArgs '*:files:_versionedFiles'
69
if (( CURRENT == 2 )); then
70
_arguments $helpArgs \
71
'(-r)--revision:rev:' \
72
'(--revision)-r:rev:' \
73
'--basis[specify basis branch]:basis:' \
74
'*:FROM_LOCATION:_files -/'
75
elif (( CURRENT == 3 )); then
76
_arguments $helpArgs \
77
'(-r)--revision:rev:' \
78
'(--revision)-r:rev:' \
79
'--basis[specify basis branch]:basis:' \
80
'*:TO_LOCATION:_files -/'
85
if (( CURRENT == 2 )); then
86
_arguments $helpArgs '*:old name:_versionedFiles'
88
_arguments $helpArgs '*:new name:'
93
_arguments $helpArgs \
94
'(-r)--revision:rev:' \
95
'(--revision)-r:rev:' \
96
'*:file:_versionedFiles'
100
_arguments $helpArgs '*:file:_files'
104
_arguments $helpArgs \
105
'(-r)--revision[revision or range]:rev or rev range:' \
106
'(--revision)-r[revision or range]:rev or rev range:' \
107
'(--verbose)-v[show revision manifest]' \
108
'(-v)--verbose[show revision manifest]' \
109
'(--short --long)-l[use long format (default)]' \
110
'(--short -l)--long[use long format (default)]' \
111
'(-l --long)--short[use short format]' \
112
'(--message)-m[specify regexp]:regexp:' \
113
'(-m)--message[specify regexp]:regexp:' \
114
'--show-ids[show file IDs]' \
115
'--forward[reverse direction of revisions]' \
116
'--timezoe[specify timezone for dates]:timezone:' \
117
'*:file:_versionedFiles'
121
_arguments $helpArgs '--all' '*:file:_versionedFiles'
125
_arguments $helpArgs \
126
'--all[include unchanged versioned files]' \
127
'--show-ids[show file IDs]' \
128
'*:file:_versionedFiles'
132
_arguments $helpArgs \
138
(mkdir|upgrade|renames)
139
_arguments $helpArgs '*:DIR:_files -/'
143
_arguments $helpArgs \
146
'*:file:_versionedFiles'
150
_arguments $helpArgs \
151
'--remember[Remember the specified location as a default]' \
152
'--overwrite[Ignore differences, overwrite unconditionally]' \
153
'*:local repository:_files -/'
154
[[ -r $parentFile ]] && compadd -X "Completing parents" $(cat $parentFile)
158
_arguments $helpArgs \
159
'(--verbose -q --quiet)-v' \
160
'(-v -q --quiet)--verbose' \
161
'(--verbose -v --quiet)-q' \
162
'(-v -q --verbose)--quiet' \
163
'*:local repository:_files -/'
164
[[ -r $parentFile ]] && compadd -X "Completing parents" $(cat $parentFile)
168
_arguments $helpArgs \
169
'(--message)-m[commit message]:message text:' \
170
'(-m)--message[commit message]:message text:' \
171
'(--file)-F[commit message from file]:message file:' \
172
'(-F)--file[commit message from file]:message file:' \
173
'--unchanged[include unchanged files]' \
176
'*:modified files:_versionedFiles'
179
(conflicts|added|deleted|modified|unknowns|directories|ignored)
188
_arguments $helpArgs '--email[only show e-mail address]'
192
_arguments $helpArgs \
193
'(-r)--revision[show inventory of a revision]:revision:' \
194
'(--revision)-r[show inventory of a revision]:revision:' \
195
'--show-ids[show file IDs]'
199
_arguments $helpArgs \
200
'(-r)--revision:revision:' \
201
'(--revision)-r:revision:' \
202
'--diff-options[options to pass to gdiff]:diff options:' \
207
_arguments $helpArgs \
208
'(-r)--revision:revision:' \
209
'(--revision)-r:revision:' \
210
'--format=[format of exported file]:format:(dir tar tgz tbz2)' \
211
'--root[root directory of patch]:_files -/' \
212
'*:destination:_files'
216
_arguments $helpArgs '*:NAME_PATTERN:_unknownRoot'
220
_arguments $helpArgs '*:branch:_files -/'
224
_arguments $helpArgs \
225
'(-r)--revision:revision:' \
226
'(--revision)-r:revision:' \
232
(revert|merge-revert)
233
_arguments $helpArgs \
234
'(-r)--revision:revision:' \
235
'(--revision)-r:revision:' \
236
'--no-backup[skip generation of backup~ files]' \
237
'*:file:_versionedFiles'
241
_arguments $helpArgs \
242
'(-r)--revision:revision:' \
243
'(--revision)-r:revision:' \
244
'--reprocess[Reprocess to reduce spurious conflicts]' \
245
'--show-base[Show base revision text in conflicts]' \
246
'--force[ignore uncommitted changes]' \
247
'--merge-type:merge type:(diff3 merge3 weave)' \
248
'*:local repository:_files -/'
249
[[ -r $parentFile ]] && compadd -X "Completing parents" $(cat $parentFile)
253
_arguments $helpArgs \
254
'(--verbose)-v[display more information]' \
255
'(-v)--verbose[display more information]' \
256
'(-r)--revision:revision:' \
257
'(--revision)-r:revision:' \
258
'--from-root[Print all paths from the root of the branch]' \
259
'--non-recursive[Do not recurse into subdirectories]' \
260
'--null[Null separate the files]' \
261
'--ignored[Print ignored files]' \
262
'--unknown[Print unknown files]' \
263
'--versioned[Print versioned files]'
267
if (( CURRENT == 2 )); then
268
_arguments $helpArgs '*:files:_versionedFiles'
270
_arguments '*:destination dir:_files -/'
275
_bzr_subcommands=(${(f)"$(_call_program bzr bzr shell-complete)"})
276
_arguments $helpArgs \
280
_describe -t subcommand 'subcommand' _bzr_subcommands
285
(visualize|visualise|viz|vis)
286
_arguments $helpArgs \
287
'(-r)--revision[starting revision]:rev:' \
288
'(--revision)-r[starting revision]:rev:'
291
(gannotate|gblame|gpraise)
292
_arguments $helpArgs \
293
'--all[show annotations on all lines]' \
294
'--plain[do not hightlight annotation lines]' \
295
'*:files:_versionedFiles'
299
_arguments $helpArgs \
300
'--overwrite[Ignore differences, overwrite unconditionally]' \
301
'*:local repository:_files -/'
302
[[ -r $parentFile ]] && compadd -X "Completing parents" $(cat $parentFile)
306
_arguments $helpArgs \
307
'--dry-run[show files to delete instead of deleting them]' \
308
'--ignored[delete all ignored files]' \
309
'--detritus[delete conflict files, merge backups, failed self-tests, *~, *.tmp, etc]'
314
_message "unknown bzr command completion: $service"
8
# your $fpath, and also for compinit to be run.
11
_arguments -S "1::bzr command:($(bzr help commands | grep '^ '))"