Mercurial > hg > mercurial-crew-with-dirclash
comparison contrib/zsh_completion @ 1438:c22da894e4cc
zsh completions: new -M, -m arguments for log, etc.
author | Steve Borho <steve@borho.org> |
---|---|
date | Mon, 24 Oct 2005 16:54:07 -0700 |
parents | d1d605d1e839 |
children | d32dbf86b88d |
comparison
equal
deleted
inserted
replaced
1437:ea51d296085f | 1438:c22da894e4cc |
---|---|
12 # option) any later version. | 12 # option) any later version. |
13 # | 13 # |
14 | 14 |
15 local curcontext="$curcontext" state line | 15 local curcontext="$curcontext" state line |
16 typeset -A opt_args | 16 typeset -A opt_args |
17 local subcmds repos tags newFiles addedFiles | 17 local subcmds repos tags newFiles addedFiles includeExclude |
18 | 18 |
19 tags=($(hg tags 2> /dev/null | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')) | 19 tags=($(hg tags 2> /dev/null | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')) |
20 subcmds=($(hg -v help | sed -e '1,/^list of commands:/d' \ | 20 subcmds=($(hg -v help | sed -e '1,/^list of commands:/d' \ |
21 -e '/^global options:/,$d' -e '/^ [^ ]/!d; s/[,:]//g;')) | 21 -e '/^global options:/,$d' -e '/^ [^ ]/!d; s/[,:].*//g;')) |
22 | |
23 # A lot of commands have these arguments | |
24 includeExclude=( | |
25 '*-I-[include names matching the given patterns]:dir:_files -W $(hg root) -/' | |
26 '*--include-[include names matching the given patterns]:dir:_files -W $(hg root) -/' | |
27 '*-X-[exclude names matching the given patterns]:dir:_files -W $(hg root) -/' | |
28 '*--exclude-[exclude names matching the given patterns]:dir:_files -W $(hg root) -/') | |
22 | 29 |
23 if [[ $service == "hg" ]]; then | 30 if [[ $service == "hg" ]]; then |
24 _arguments -C -A "-*" \ | 31 _arguments -C -A "-*" \ |
25 '-R+[repository root directory]' \ | 32 '(--repository)-R[repository root directory]:root:_files -/' \ |
26 '-y[non-interactive]' \ | 33 '(-R)--repository[repository root directory]:root:_files -/' \ |
27 '-v[verbose]' \ | 34 '--cwd[change working directory]:new working directory:_files -/' \ |
28 '-q[quiet]' \ | 35 '(--noninteractive)-y[do not prompt, assume yes for any required answers]' \ |
36 '(-y)--noninteractive[do not prompt, assume yes for any required answers]' \ | |
37 '(--verbose)-v[enable additional output]' \ | |
38 '(-v)--verbose[enable additional output]' \ | |
39 '(--quiet)-q[suppress output]' \ | |
40 '(-q)--quiet[suppress output]' \ | |
41 '(--help)-h[display help and exit]' \ | |
42 '(-h)--help[display help and exit]' \ | |
43 '--debug[debug mode]' \ | |
44 '--debugger[start debugger]' \ | |
45 '--traceback[print traceback on exception]' \ | |
29 '--time[time how long the command takes]' \ | 46 '--time[time how long the command takes]' \ |
30 '--profile[profile]' \ | 47 '--profile[profile]' \ |
31 '-h-[display help and exit]' \ | 48 '--version[output version information and exit]' \ |
32 '--version-[output version information and exit]' \ | |
33 '--cwd[change working directory]:new working directory:_files -/' \ | |
34 '*::command:->subcmd' && return 0 | 49 '*::command:->subcmd' && return 0 |
35 | 50 |
36 if (( CURRENT == 1 )); then | 51 if (( CURRENT == 1 )); then |
37 _wanted commands expl 'hg command' compadd -a subcmds | 52 _wanted commands expl 'hg command' compadd -a subcmds |
38 return | 53 return |
40 service="$words[1]" | 55 service="$words[1]" |
41 curcontext="${curcontext%:*}=$service:" | 56 curcontext="${curcontext%:*}=$service:" |
42 fi | 57 fi |
43 | 58 |
44 case $service in | 59 case $service in |
45 (addremove) | |
46 _arguments \ | |
47 '-I[include path in search]:dir:_files -W $(hg root) -/' \ | |
48 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \ | |
49 '*:directories:_files -/' # assume they want to add/remove a dir | |
50 ;; | |
51 | |
52 (add) | 60 (add) |
53 newFiles=( $(hg status -un) ) | 61 newFiles=( $(hg status -un) ) |
54 _arguments \ | 62 _arguments $includeExclude \ |
55 '-I[include path in search]:dir:_files -W $(hg root) -/' \ | 63 '*:file:->unknown' |
56 '-X[exclude path in search]:dir:_files -W $(hg root) -/' | |
57 _wanted files expl 'unknown files' compadd -a newFiles | 64 _wanted files expl 'unknown files' compadd -a newFiles |
58 ;; | 65 ;; |
59 | 66 |
67 (addremove) | |
68 _arguments $includeExclude \ | |
69 '*:directories:_files -/' # assume they want to add/remove a dir | |
70 ;; | |
71 | |
72 (forget) | |
73 addedFiles=( $(hg status -an) ) | |
74 _arguments $includeExclude \ | |
75 '*:file:->added' | |
76 _wanted files expl 'newly added files' compadd -a addedFiles | |
77 ;; | |
78 | |
60 (remove|rm) | 79 (remove|rm) |
61 _arguments \ | 80 _arguments $includeExclude \ |
62 '-I[include path in search]:dir:_files -W $(hg root) -/' \ | |
63 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \ | |
64 '*:file:_files' | 81 '*:file:_files' |
65 ;; | 82 ;; |
66 | 83 |
84 (copy|cp) | |
85 _arguments $includeExclude \ | |
86 '(--after)-A[record a copy that has already occurred]' \ | |
87 '(-A)--after[record a copy that has already occurred]' \ | |
88 '(--force)-f[forcibly copy over an existing managed file]' \ | |
89 '(-f)--force[forcibly copy over an existing managed file]' \ | |
90 '(--parents)-p[append source path to dest]' \ | |
91 '(-p)--parents[append source path to dest]' \ | |
92 '*:files:_files' | |
93 ;; | |
94 | |
95 (rename|mv) | |
96 if (( CURRENT == 2 )); then | |
97 _arguments $includeExclude \ | |
98 '(--after)-A[record a rename that has already occurred]' \ | |
99 '(-A)--after[record a rename that has already occurred]' \ | |
100 '(--force)-f[replace destination if it exists]' \ | |
101 '(-F)--force[replace destination if it exists]' \ | |
102 '(--parents)-p[append source path to dest]' \ | |
103 '(-p)--parents[append source path to dest]' \ | |
104 '*:files:_files' | |
105 else | |
106 _arguments '*:destination:_files' | |
107 fi | |
108 ;; | |
109 | |
110 (diff) | |
111 _arguments $includeExclude \ | |
112 '*-r[revision]:revision:($tags)' \ | |
113 '*--rev[revision]:revision:($tags)' \ | |
114 '(--text)-a[treat all files as text]' \ | |
115 '(-a)--text[treat all files as text]' \ | |
116 '*:file:_files' | |
117 ;; | |
118 | |
119 (status) | |
120 _arguments $includeExclude \ | |
121 '(--no-status)-n[hide status prefix]' \ | |
122 '(-n)--no-status[hide status prefix]' \ | |
123 '(--print0)-0[end filenames with NUL, for use with xargs]' \ | |
124 '(-0)--print0[end filenames with NUL, for use with xargs]' \ | |
125 '(--modified)-m[show only modified files]' \ | |
126 '(-m)--modified[show only modified files]' \ | |
127 '(--added)-a[show only added files]' \ | |
128 '(-a)--added[show only added files]' \ | |
129 '(--removed)-r[show only removed files]' \ | |
130 '(-r)--removed[show only removed files]' \ | |
131 '(--unknown)-u[show only unknown files]' \ | |
132 '(-u)--unknown[show only unknown files]' \ | |
133 '*:search pattern, then files:_files' | |
134 ;; | |
135 | |
136 (revert) | |
137 addedFiles=( $(hg status -mrn) ) # modified, removed | |
138 _arguments \ | |
139 '(--rev)-r[revision to revert to]:revision:($tags)' \ | |
140 '(-r)--rev[revision to revert to]:revision:($tags)' \ | |
141 '(--nonrecursive)-n[do not recurse into subdirectories]' \ | |
142 '(-n)--nonrecursive[do not recurse into subdirectories]' \ | |
143 '*:file:->modified' | |
144 _wanted files expl 'mofified files' compadd -a addedFiles | |
145 ;; | |
146 | |
147 (commit|ci) | |
148 addedFiles=( $(hg status -amrn) ) # added, modified, removed | |
149 _arguments $includeExclude \ | |
150 '(--addremove)-A[run addremove during commit]' \ | |
151 '(-A)--addremove[run addremove during commit]' \ | |
152 '(--message)-m[use <txt> as commit message]:string:' \ | |
153 '(-m)--message[use <txt> as commit message]:string:' \ | |
154 '(--logfile)-l[read commit message from <file>]:.log file:_file -g \*.txt' \ | |
155 '(-l)--logfile[read commit message from <file>]:.log file:_file -g \*.txt' \ | |
156 '(--date)-d[record datecode as commit date]:date code:' \ | |
157 '(-d)--date[record datecode as commit date]:date code:' \ | |
158 '(--user)-u[record user as commiter]:user:' \ | |
159 '(-u)--user[record user as commiter]:user:' \ | |
160 '*:file:->modified' | |
161 _wanted files expl 'mofified files' compadd -a addedFiles | |
162 ;; | |
163 | |
67 (cat) | 164 (cat) |
68 _arguments \ | 165 _arguments $includeExclude \ |
69 '-I[include path in search]:dir:_files -W $(hg root) -/' \ | 166 '(--output)-o[print output to file with formatted name]:filespec:' \ |
70 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \ | 167 '(-o)--output[print output to file with formatted name]:filespec:' \ |
71 '-o[output to file]:file:' \ | 168 '(--rev)-r[revision]:revision:($tags)' \ |
72 '-r[revision]:revision:($tags)' \ | 169 '(-r)--rev[revision]:revision:($tags)' \ |
73 '*:file:_files' | 170 '*:file:_files' |
74 ;; | 171 ;; |
75 | 172 |
76 (checkout|update|up|co) | 173 (annotate) |
77 _arguments \ | 174 _arguments $includeExclude \ |
78 '-b[checkout the head of a specific branch]:tag:' \ | 175 '(--rev)-r[annotate the specified revision]:revision:($tags)' \ |
79 '-m[allow merging of conflicts]' \ | 176 '(-r)--rev[annotate the specified revision]:revision:($tags)' \ |
80 '-C[overwrite locally modified files]' \ | 177 '(--text)-a[treat all files as text]' \ |
178 '(-a)--text[treat all files as text]' \ | |
179 '(--user)-u[list the author]' \ | |
180 '(-u)--user[list the author]' \ | |
181 '(--changeset)-c[list the changeset]' \ | |
182 '(-c)--changeset[list the changeset]' \ | |
183 '(--number)-n[list the revision number (default)]' \ | |
184 '(-n)--number[list the revision number (default)]' \ | |
185 '*:files:_files' | |
186 ;; | |
187 | |
188 (grep) | |
189 _arguments $includeExclude \ | |
190 '*-r[search in given revision range]:revision:($tags)' \ | |
191 '*--rev[search in given revision range]:revision:($tags)' \ | |
192 '--all[print all revisions with matches]' \ | |
193 '(-print0)-0[end filenames with NUL, for use with xargs]' \ | |
194 '(-0)--print0[end filenames with NUL, for use with xargs]' \ | |
195 '(--ignore-case)-i[ignore case when matching]' \ | |
196 '(-i)--ignore-case[ignore case when matching]' \ | |
197 '(--files-with-matches)-l[print names of files and revs that match]' \ | |
198 '(-l)--files-with-matches[print names of files and revs that match]' \ | |
199 '(--line-number)-n[print matching line numbers]' \ | |
200 '(-n)--line-number[print matching line numbers]' \ | |
201 '(--user)-u[print user who committed change]' \ | |
202 '(-u)--user[print user who committed change]' \ | |
203 '*:search pattern:' | |
204 ;; | |
205 | |
206 (locate) | |
207 _arguments $includeExclude \ | |
208 '(--rev)-r[search repository as it stood at revision]:revision:($tags)' \ | |
209 '(-r)--rev[search repository as it stood at revision]:revision:($tags)' \ | |
210 '(--print0)-0[end filenames with NUL, for use with xargs]' \ | |
211 '(-0)--print0[end filenames with NUL, for use with xargs]' \ | |
212 '(--fullpath)-f[print complete paths]' \ | |
213 '(-f)--fullpath[print complete paths]' \ | |
214 '*:search pattern:' | |
215 ;; | |
216 | |
217 (log|history) | |
218 _arguments $includeExclude \ | |
219 '*-r[show the specified revision or range]:revision:($tags)' \ | |
220 '*--rev[show the specified revision or range]:revision:($tags)' \ | |
221 '(--no-merges -M --only-merges)-m[show only merge revisions]' \ | |
222 '(--no-merges -M -m)--only-merges[show only merge revisions]' \ | |
223 '(--only-merges -m --no-merges)-M[do not show merge revisions]' \ | |
224 '(--only-merges -m -M)--no-merges[do not show merge revisions]' \ | |
225 '(--keyword)-k[search for a keyword]:keyword:' \ | |
226 '(-k)--keyword[search for a keyword]:keyword:' \ | |
227 '(--branch)-b[show branches]' \ | |
228 '(-b)--branch[show branches]' \ | |
229 '(--patch)-p[show patch]' \ | |
230 '(-p)--patch[show patch]' \ | |
231 '*:file:_files' | |
232 ;; | |
233 | |
234 (update|checkout|co) | |
235 _arguments \ | |
236 '(--branch)-b[checkout the head of a specific branch]' \ | |
237 '(-b)--branch[checkout the head of a specific branch]' \ | |
238 '(-C --clean --merge)-m[allow merging of branches]' \ | |
239 '(-C --clean -m)--merge[allow merging of branches]' \ | |
240 '(-m --merge --clean)-C[overwrite locally modified files]' \ | |
241 '(-m --merge -C)--clean[overwrite locally modified files]' \ | |
242 '*:revision or tag:($tags)' | |
243 ;; | |
244 | |
245 (tag) | |
246 _arguments \ | |
247 '(--local)-l[make the tag local]' \ | |
248 '(-l)--local[make the tag local]' \ | |
249 '(--message)-m[message for tag commit log entry]:string:' \ | |
250 '(-m)--message[message for tag commit log entry]:string:' \ | |
251 '(--date)-d[record datecode as commit date]:date code:' \ | |
252 '(-d)--date[record datecode as commit date]:date code:' \ | |
253 '(--user)-u[record user as commiter]:user:' \ | |
254 '(-u)--user[record user as commiter]:user:' \ | |
255 '*:name, then revision:($tags)' | |
256 ;; | |
257 | |
258 (clone) | |
259 if (( CURRENT == 2 )); then | |
260 _arguments \ | |
261 '(--no-update)-U[do not update the new working directory]' \ | |
262 '(-U)--no-update[do not update the new working directory]' \ | |
263 '(--ssh)-e[specify ssh command to use]:string:' \ | |
264 '(-e)--ssh[specify ssh command to use]:string:' \ | |
265 '--pull[use pull protocol to copy metadata]' \ | |
266 '--remotecmd[specify hg command to run on the remote side]:remote hg:' \ | |
267 '*:local repo:_files -/' | |
268 elif (( CURRENT == 3 )); then | |
269 _arguments '*:dest repo:_files -/' | |
270 fi | |
271 ;; | |
272 | |
273 (rawcommit) | |
274 _arguments \ | |
275 '(--parent)-p[parent revision]:revision:($tags)' \ | |
276 '(-p)--parent[parent revision]:revision:($tags)' \ | |
277 '(--date)-d[record datecode as commit date]:date code:' \ | |
278 '(-d)--date[record datecode as commit date]:date code:' \ | |
279 '(--user)-u[record user as commiter]:user:' \ | |
280 '(-u)--user[record user as commiter]:user:' \ | |
281 '(--message)-m[use <txt> as commit message]:string:' \ | |
282 '(-m)--message[use <txt> as commit message]:string:' \ | |
283 '(--logfile)-l[read commit message from <file>]:.log file:_file -g \*.txt' \ | |
284 '(-l)--logfile[read commit message from <file>]:.log file:_file -g \*.txt' \ | |
285 '(--files)-F[file list]:file list:_files' \ | |
286 '(-F)--files[file list]:file list:_files' \ | |
287 '*:files to commit:_files' | |
288 ;; | |
289 | |
290 (bundle) | |
291 if (( CURRENT == 2 )); then | |
292 _arguments '*:changegroup file:_files -g \*.hg' | |
293 elif (( CURRENT == 3 )); then | |
294 _arguments '*:other repo:_files -/' | |
295 fi | |
296 ;; | |
297 | |
298 (unbundle) | |
299 _arguments '*:changegroup .hg file:_files -g \*.hg' | |
300 ;; | |
301 | |
302 (incoming) | |
303 _arguments \ | |
304 '(--patch)-p[show patch]' \ | |
305 '(-p)--patch[show patch]' \ | |
306 '(--no-merges)-M[do not show merge revisions]' \ | |
307 '(-M)--no-merges[do not show merge revisions]' \ | |
308 '*:mercurial repository:_files -/' | |
309 ;; | |
310 | |
311 (import|patch) | |
312 _arguments \ | |
313 '(--strip)-p[directory strip option for patch (default: 1)]:count:' \ | |
314 '(-p)--strip[directory strip option for patch (default: 1)]:count:' \ | |
315 '(--force)-f[skip check for outstanding uncommitted changes]' \ | |
316 '(-f)--force[skip check for outstanding uncommitted changes]' \ | |
317 '(--base)-b[base directory to read patches from]:file:_files -W $(hg root) -/' \ | |
318 '(-b)--base[base directory to read patches from]:file:_files -W $(hg root) -/' \ | |
319 '*:patch file:_files' | |
320 ;; | |
321 | |
322 (pull) | |
323 repos=( $(hg paths | sed -e 's/^.*= //') ) | |
324 _arguments \ | |
325 '(--update)-u[update working directory to tip after pull]' \ | |
326 '(-u)--update[update working directory to tip after pull]' \ | |
327 '(--ssh)-e[specify ssh command to use]:ssh command:' \ | |
328 '(-e)--ssh[specify ssh command to use]:ssh command:' \ | |
329 '--remotecmd[specify hg command to run on the remote side]:remote hg:' \ | |
330 '*:local repo:_files -/' | |
331 _wanted source expl 'source repository' compadd -a repos | |
332 ;; | |
333 | |
334 (outgoing) | |
335 _arguments \ | |
336 '(--patch)-p[show patch]' \ | |
337 '(-p)--patch[show patch]' \ | |
338 '(--no-merges)-M[do not show merge revisions]' \ | |
339 '(-M)--no-merges[do not show merge revisions]' \ | |
340 '*:local repo:_files -/' | |
341 _wanted source expl 'source repository' compadd -a repos | |
342 ;; | |
343 | |
344 (export) | |
345 _arguments \ | |
346 '(--outout)-o[print output to file with formatted name]:filespec:' \ | |
347 '(-o)--output[print output to file with formatted name]:filespec:' \ | |
348 '(--text)-a[treat all files as text]' \ | |
349 '(-a)--text[treat all files as text]' \ | |
81 '*:revision:->revs' | 350 '*:revision:->revs' |
82 _wanted revs expl 'revision or tag' compadd -a tags | 351 _wanted revs expl 'revision or tag' compadd -a tags |
83 ;; | 352 ;; |
84 | 353 |
85 (commit|ci) | 354 (push) |
86 _arguments \ | 355 repos=( $(hg paths | sed -e 's/^.*= //') ) |
87 '-I[include path in search]:dir:_files -W $(hg root) -/' \ | 356 _arguments \ |
88 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \ | 357 '(--force)-f[force push]' \ |
89 '-A[run addremove during commit]' \ | 358 '(-f)--force[force push]' \ |
90 '-m[commit message]:string:' \ | 359 '(--ssh)-e[specify ssh command to use]:ssh command:' \ |
91 '-d[date code]:string:' \ | 360 '(-e)--ssh[specify ssh command to use]:ssh command:' \ |
92 '-u[user]:string:' \ | 361 '--remotecmd[specify hg command to run on the remote side]:remote hg:' \ |
93 '*:file:_files' | 362 '*:local repo:_files -/' |
94 ;; | 363 _wanted source expl 'source repository' compadd -a repos |
95 | 364 ;; |
96 (tag) | 365 |
97 _arguments \ | 366 (serve) |
98 '-l[make the tag local]:' \ | 367 _arguments \ |
99 '-m[commit message]:string:' \ | 368 '(--accesslog)-A[name of access log file]:log file:_files' \ |
100 '-d[date code]:string:' \ | 369 '(-A)--accesslog[name of access log file]:log file:_files' \ |
101 '-u[user]:string:' \ | 370 '(--errorlog)-E[name of error log file]:log file:_files' \ |
102 '*:name and revision:' | 371 '(-E)--errorlog[name of error log file]:log file:_files' \ |
103 ;; | 372 '(--port)-p[listen port]:listen port:' \ |
104 | 373 '(-p)--port[listen port]:listen port:' \ |
105 (clone) | 374 '(--address)-a[interface address]:interface address:' \ |
106 _arguments \ | 375 '(-a)--address[interface address]:interface address:' \ |
107 '-U[skip update after cloning]' \ | 376 '(--name)-n[name to show in web pages]:repository name:' \ |
108 '-e[ssh command]:string:' \ | 377 '(-n)--name[name to show in web pages]:repository name:' \ |
109 '--pull[use pull protocol to copy metadata]' \ | 378 '(--templates)-t[web template directory]:template dir:_files -/' \ |
110 '--remotecmd[remote hg command]:command:->subcmd' | 379 '(-t)--templates[web template directory]:template dir:_files -/' \ |
111 ;; | 380 '--style[web template style]:style' \ |
112 | 381 '--stdio[for remote clients]' \ |
113 (export) | 382 '(--ipv6)-6[use IPv6 in addition to IPv4]' \ |
114 _arguments \ | 383 '(-6)--ipv6[use IPv6 in addition to IPv4]' |
115 '-o[output to a file]:file:' \ | 384 ;; |
116 '-a-[tread all files as text]' \ | 385 |
117 '*:revision:->revs' | 386 (help) |
118 _wanted revs expl 'revision or tag' compadd -a tags | 387 _wanted commands expl 'hg command' compadd -a subcmds |
119 ;; | 388 ;; |
120 | 389 |
121 (heads) | 390 (heads) |
122 _arguments '-b[find branch info]' | 391 _arguments \ |
123 ;; | 392 '(--branches)-b[find branch info]' \ |
124 | 393 '(-b)--branches[find branch info]' |
125 (outgoing|out) | |
126 _arguments '-p[show patch]' | |
127 ;; | 394 ;; |
128 | 395 |
129 (paths) | 396 (paths) |
130 _arguments '*:symbolic name:(default default-push)' | 397 _arguments '*:symbolic name:(default default-push)' |
131 ;; | 398 ;; |
132 | 399 |
133 (init) | 400 (init) |
134 _arguments '*:new repo directory:_files -/' | 401 _arguments '*:new repo directory:_files -/' |
135 ;; | 402 ;; |
136 | 403 |
137 (unbundle) | |
138 _arguments '*:changegroup file:_files' | |
139 ;; | |
140 | |
141 (manifest) | 404 (manifest) |
142 _arguments \ | 405 _arguments '*:revision:($tags)' |
143 '*:revision:->revs' | |
144 _wanted revs expl 'revision or tag' compadd -a tags | |
145 ;; | 406 ;; |
146 | 407 |
147 (parents) | 408 (parents) |
148 _arguments \ | 409 _arguments '*:revision:($tags)' |
149 '*:revision:->revs' | 410 ;; |
150 _wanted revs expl 'revision or tag' compadd -a tags | 411 |
151 ;; | 412 (identify|recover|root|undo|view|verify|version|ct|tags) |
152 | |
153 (serve) | |
154 _arguments \ | |
155 '-A[access log file]:log file:_files' \ | |
156 '-E[error log file]:log file:_files' \ | |
157 '-p[listen port]:listen port:' \ | |
158 '-a[interface address]:interface address:' \ | |
159 '-n[repository name]:repository name:' \ | |
160 '--stdio[for remote clients]' \ | |
161 '-t[template directory]:template dir:_files -/' \ | |
162 '--style[template style]:style' \ | |
163 '-6[use IPv6 in addition to IPv4]' | |
164 ;; | |
165 | |
166 (pull) | |
167 repos=( $(hg paths | sed -e 's/^.*= //') ) | |
168 _arguments \ | |
169 '-u[update working directory]' \ | |
170 '-e[ssh command]:remote commands:' \ | |
171 '--remotecmd[remote hg command]:command:->subcmd' \ | |
172 '*:pull source:->repo' | |
173 _wanted source expl 'source repository' compadd -a repos | |
174 ;; | |
175 | |
176 (push) | |
177 repos=( $(hg paths | sed -e 's/^.*= //') ) | |
178 _arguments \ | |
179 '-f[force push]' \ | |
180 '-e[ssh command]:remote commands:' \ | |
181 '--remotecmd[remote hg command]:command:->subcmd' \ | |
182 '*:pull source:->repo' | |
183 _wanted source expl 'source repository' compadd -a repos | |
184 ;; | |
185 | |
186 (id|identify) | |
187 ;; | |
188 | |
189 (recover) | |
190 ;; | |
191 | |
192 (rawcommit) | |
193 _arguments \ | |
194 '-p[parent]:revision:($tags)' \ | |
195 '-d[date]:date:' \ | |
196 '-u[user]:user:' \ | |
197 '-F[file list]:file list:_files' \ | |
198 '-m[commit message]:string:' \ | |
199 '-l[commit message file]:message file:_files -g *.txt' \ | |
200 '*:files to commit:_files' | |
201 ;; | |
202 | |
203 (copy|cp) | |
204 _arguments \ | |
205 '-I[include path in search]:dir:_files -W $(hg root) -/' \ | |
206 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \ | |
207 '-A-[record a copy after it has happened]' \ | |
208 '-f[replace destination if it exists]' \ | |
209 '-p[append source path to dest]' \ | |
210 '*:destination:' | |
211 ;; | |
212 | |
213 (rename|mv) | |
214 _arguments \ | |
215 '-I[include path in search]:dir:_files -W $(hg root) -/' \ | |
216 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \ | |
217 '-A-[record a copy after it has happened]' \ | |
218 '-f[replace destination if it exists]' \ | |
219 '-p[append source path to dest]' \ | |
220 '*:destination:' | |
221 ;; | |
222 | |
223 (forget) | |
224 addedFiles=( $(hg status -an) ) | |
225 _arguments \ | |
226 '-I[include path in search]:dir:_files -W $(hg root) -/' \ | |
227 '-X[exclude path in search]:dir:_files -W $(hg root) -/' | |
228 _wanted files expl 'newly added files' compadd -a addedFiles | |
229 ;; | |
230 | |
231 (import|patch) | |
232 _arguments \ | |
233 '-p[path strip (default: 1)]:count:' \ | |
234 '-f[skip check for outstanding changes]' \ | |
235 '-b[base path]:file:_files -W $(hg root)' \ | |
236 '*:patch file:_files' | |
237 ;; | |
238 | |
239 (incoming|in) | |
240 _arguments \ | |
241 '-p[show patch]' \ | |
242 '*:mercurial repository:_files' | |
243 ;; | |
244 | |
245 (diff) | |
246 _arguments \ | |
247 '-I[include path in search]:dir:_files -W $(hg root) -/' \ | |
248 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \ | |
249 '-r[revision]:revision:($tags)' \ | |
250 '-a-[tread all files as text]' \ | |
251 '*:file:_files' | |
252 ;; | |
253 | |
254 (log|history) | |
255 _arguments \ | |
256 '-I[include path in search]:dir:_files -W $(hg root) -/' \ | |
257 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \ | |
258 '-r[revision]:revision:($tags)' \ | |
259 '-b[show branches]' \ | |
260 '-p[show patch]' \ | |
261 '*:file:_files' | |
262 ;; | |
263 | |
264 (grep) | |
265 _arguments \ | |
266 '-I[include path in search]:dir:_files -W $(hg root) -/' \ | |
267 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \ | |
268 '-0[end fields with NUL]' \ | |
269 '--all[print all revisions with matches]' \ | |
270 '-i[ignore case]' \ | |
271 '-l[print names of files and revs with matches]' \ | |
272 '-n[print line numbers]' \ | |
273 '-r[search in revision rev]:revision:($tags)' \ | |
274 '-u[print user who made change]' \ | |
275 '*:search pattern, then files:_files' | |
276 ;; | |
277 | |
278 (status) | |
279 _arguments \ | |
280 '-I[include path in search]:dir:_files -W $(hg root) -/' \ | |
281 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \ | |
282 '-0[end filenames with NUL]' \ | |
283 '-m[show only modified files]' \ | |
284 '-a[show only added files]' \ | |
285 '-r[show only removed files]' \ | |
286 '-u[show only unknown files]' \ | |
287 '-n[hide status prefix]' \ | |
288 '*:search pattern, then files:_files' | |
289 ;; | |
290 | |
291 (locate) | |
292 _arguments \ | |
293 '-r[search in revision rev]:revision:($tags)' \ | |
294 '-0[end fields with NUL]' \ | |
295 '-f[print complete paths]' \ | |
296 '-I[include path in search]:dir:_files -W $(hg root) -/' \ | |
297 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \ | |
298 '*:search pattern:' | |
299 ;; | |
300 | |
301 (help) | |
302 _wanted commands expl 'hg command' compadd -a subcmds | |
303 ;; | |
304 | |
305 (root|undo|view|verify|version) | |
306 # no arguments for these commands | 413 # no arguments for these commands |
307 ;; | 414 ;; |
308 | 415 |
309 (*) | 416 (*) |
310 _message "unknown hg command completion: $service" | 417 _message "unknown hg command completion: $service" |