author | Steve Borho <steve@borho.org> |
Sat, 01 Oct 2005 00:02:01 -0700 | |
changeset 1368 | d1d605d1e839 |
parent 1365 | 74cf45f8bc19 |
child 1438 | c22da894e4cc |
permissions | -rw-r--r-- |
1362 | 1 |
#compdef hg |
2 |
||
3 |
# Zsh completion script for mercurial. Rename this file to _hg and copy |
|
4 |
# it into your zsh function path (/usr/share/zsh/site-functions for |
|
5 |
# instance) |
|
6 |
# |
|
7 |
# Copyright (C) 2005 Steve Borho |
|
8 |
# |
|
9 |
# This is free software; you can redistribute it and/or modify it under |
|
10 |
# the terms of the GNU General Public License as published by the Free |
|
11 |
# Software Foundation; either version 2 of the License, or (at your |
|
12 |
# option) any later version. |
|
13 |
# |
|
14 |
||
15 |
local curcontext="$curcontext" state line |
|
16 |
typeset -A opt_args |
|
17 |
local subcmds repos tags newFiles addedFiles |
|
18 |
||
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
19 |
tags=($(hg tags 2> /dev/null | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')) |
1362 | 20 |
subcmds=($(hg -v help | sed -e '1,/^list of commands:/d' \ |
21 |
-e '/^global options:/,$d' -e '/^ [^ ]/!d; s/[,:]//g;')) |
|
22 |
||
23 |
if [[ $service == "hg" ]]; then |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
24 |
_arguments -C -A "-*" \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
25 |
'-R+[repository root directory]' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
26 |
'-y[non-interactive]' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
27 |
'-v[verbose]' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
28 |
'-q[quiet]' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
29 |
'--time[time how long the command takes]' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
30 |
'--profile[profile]' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
31 |
'-h-[display help and exit]' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
32 |
'--version-[output version information and exit]' \ |
1362 | 33 |
'--cwd[change working directory]:new working directory:_files -/' \ |
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
34 |
'*::command:->subcmd' && return 0 |
1362 | 35 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
36 |
if (( CURRENT == 1 )); then |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
37 |
_wanted commands expl 'hg command' compadd -a subcmds |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
38 |
return |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
39 |
fi |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
40 |
service="$words[1]" |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
41 |
curcontext="${curcontext%:*}=$service:" |
1362 | 42 |
fi |
43 |
||
44 |
case $service in |
|
45 |
(addremove) |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
46 |
_arguments \ |
1362 | 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) |
|
53 |
newFiles=( $(hg status -un) ) |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
54 |
_arguments \ |
1362 | 55 |
'-I[include path in search]:dir:_files -W $(hg root) -/' \ |
56 |
'-X[exclude path in search]:dir:_files -W $(hg root) -/' |
|
57 |
_wanted files expl 'unknown files' compadd -a newFiles |
|
58 |
;; |
|
59 |
||
60 |
(remove|rm) |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
61 |
_arguments \ |
1362 | 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' |
|
65 |
;; |
|
66 |
||
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
67 |
(cat) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
68 |
_arguments \ |
1362 | 69 |
'-I[include path in search]:dir:_files -W $(hg root) -/' \ |
70 |
'-X[exclude path in search]:dir:_files -W $(hg root) -/' \ |
|
71 |
'-o[output to file]:file:' \ |
|
72 |
'-r[revision]:revision:($tags)' \ |
|
73 |
'*:file:_files' |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
74 |
;; |
1362 | 75 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
76 |
(checkout|update|up|co) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
77 |
_arguments \ |
1362 | 78 |
'-b[checkout the head of a specific branch]:tag:' \ |
79 |
'-m[allow merging of conflicts]' \ |
|
80 |
'-C[overwrite locally modified files]' \ |
|
81 |
'*:revision:->revs' |
|
82 |
_wanted revs expl 'revision or tag' compadd -a tags |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
83 |
;; |
1362 | 84 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
85 |
(commit|ci) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
86 |
_arguments \ |
1362 | 87 |
'-I[include path in search]:dir:_files -W $(hg root) -/' \ |
88 |
'-X[exclude path in search]:dir:_files -W $(hg root) -/' \ |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
89 |
'-A[run addremove during commit]' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
90 |
'-m[commit message]:string:' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
91 |
'-d[date code]:string:' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
92 |
'-u[user]:string:' \ |
1362 | 93 |
'*:file:_files' |
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
94 |
;; |
1362 | 95 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
96 |
(tag) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
97 |
_arguments \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
98 |
'-l[make the tag local]:' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
99 |
'-m[commit message]:string:' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
100 |
'-d[date code]:string:' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
101 |
'-u[user]:string:' \ |
1362 | 102 |
'*:name and revision:' |
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
103 |
;; |
1362 | 104 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
105 |
(clone) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
106 |
_arguments \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
107 |
'-U[skip update after cloning]' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
108 |
'-e[ssh command]:string:' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
109 |
'--pull[use pull protocol to copy metadata]' \ |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
110 |
'--remotecmd[remote hg command]:command:->subcmd' |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
111 |
;; |
1362 | 112 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
113 |
(export) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
114 |
_arguments \ |
1362 | 115 |
'-o[output to a file]:file:' \ |
116 |
'-a-[tread all files as text]' \ |
|
117 |
'*:revision:->revs' |
|
118 |
_wanted revs expl 'revision or tag' compadd -a tags |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
119 |
;; |
1362 | 120 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
121 |
(heads) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
122 |
_arguments '-b[find branch info]' |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
123 |
;; |
1362 | 124 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
125 |
(outgoing|out) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
126 |
_arguments '-p[show patch]' |
1362 | 127 |
;; |
128 |
||
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
129 |
(paths) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
130 |
_arguments '*:symbolic name:(default default-push)' |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
131 |
;; |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
132 |
|
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
133 |
(init) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
134 |
_arguments '*:new repo directory:_files -/' |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
135 |
;; |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
136 |
|
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
137 |
(unbundle) |
1362 | 138 |
_arguments '*:changegroup file:_files' |
139 |
;; |
|
140 |
||
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
141 |
(manifest) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
142 |
_arguments \ |
1362 | 143 |
'*:revision:->revs' |
144 |
_wanted revs expl 'revision or tag' compadd -a tags |
|
145 |
;; |
|
146 |
||
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
147 |
(parents) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
148 |
_arguments \ |
1362 | 149 |
'*:revision:->revs' |
150 |
_wanted revs expl 'revision or tag' compadd -a tags |
|
151 |
;; |
|
152 |
||
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
153 |
(serve) |
1362 | 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 |
||
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
166 |
(pull) |
1362 | 167 |
repos=( $(hg paths | sed -e 's/^.*= //') ) |
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
168 |
_arguments \ |
1362 | 169 |
'-u[update working directory]' \ |
170 |
'-e[ssh command]:remote commands:' \ |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
171 |
'--remotecmd[remote hg command]:command:->subcmd' \ |
1362 | 172 |
'*:pull source:->repo' |
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
173 |
_wanted source expl 'source repository' compadd -a repos |
1362 | 174 |
;; |
175 |
||
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
176 |
(push) |
1362 | 177 |
repos=( $(hg paths | sed -e 's/^.*= //') ) |
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
178 |
_arguments \ |
1362 | 179 |
'-f[force push]' \ |
180 |
'-e[ssh command]:remote commands:' \ |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
181 |
'--remotecmd[remote hg command]:command:->subcmd' \ |
1362 | 182 |
'*:pull source:->repo' |
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
183 |
_wanted source expl 'source repository' compadd -a repos |
1362 | 184 |
;; |
185 |
||
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
186 |
(id|identify) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
187 |
;; |
1362 | 188 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
189 |
(recover) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
190 |
;; |
1362 | 191 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
192 |
(rawcommit) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
193 |
_arguments \ |
1362 | 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' |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
201 |
;; |
1362 | 202 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
203 |
(copy|cp) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
204 |
_arguments \ |
1362 | 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:' |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
211 |
;; |
1362 | 212 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
213 |
(rename|mv) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
214 |
_arguments \ |
1362 | 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:' |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
221 |
;; |
1362 | 222 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
223 |
(forget) |
1362 | 224 |
addedFiles=( $(hg status -an) ) |
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
225 |
_arguments \ |
1362 | 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 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
229 |
;; |
1362 | 230 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
231 |
(import|patch) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
232 |
_arguments \ |
1362 | 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' |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
237 |
;; |
1362 | 238 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
239 |
(incoming|in) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
240 |
_arguments \ |
1362 | 241 |
'-p[show patch]' \ |
242 |
'*:mercurial repository:_files' |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
243 |
;; |
1362 | 244 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
245 |
(diff) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
246 |
_arguments \ |
1362 | 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' |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
252 |
;; |
1362 | 253 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
254 |
(log|history) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
255 |
_arguments \ |
1362 | 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' |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
262 |
;; |
1362 | 263 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
264 |
(grep) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
265 |
_arguments \ |
1362 | 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' |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
276 |
;; |
1362 | 277 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
278 |
(status) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
279 |
_arguments \ |
1362 | 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' |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
289 |
;; |
1362 | 290 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
291 |
(locate) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
292 |
_arguments \ |
1362 | 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:' |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
299 |
;; |
1362 | 300 |
|
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
301 |
(help) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
302 |
_wanted commands expl 'hg command' compadd -a subcmds |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
303 |
;; |
1362 | 304 |
|
305 |
(root|undo|view|verify|version) |
|
306 |
# no arguments for these commands |
|
307 |
;; |
|
308 |
||
1368
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
309 |
(*) |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
310 |
_message "unknown hg command completion: $service" |
d1d605d1e839
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
Steve Borho <steve@borho.org>
parents:
1365
diff
changeset
|
311 |
;; |
1362 | 312 |
esac |