annotate contrib/zsh_completion @ 1362:246e1a00af6f

zsh completion function for hg
author Steve Borho <steve@borho.org>
date Thu, 29 Sep 2005 13:18:39 -0700
parents
children 74cf45f8bc19
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1362
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
1 #compdef hg
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
2
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
3 # Zsh completion script for mercurial. Rename this file to _hg and copy
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
4 # it into your zsh function path (/usr/share/zsh/site-functions for
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
5 # instance)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
6 #
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
7 # Copyright (C) 2005 Steve Borho
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
8 #
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
9 # This is free software; you can redistribute it and/or modify it under
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
10 # the terms of the GNU General Public License as published by the Free
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
11 # Software Foundation; either version 2 of the License, or (at your
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
12 # option) any later version.
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
13 #
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
14
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
15 local curcontext="$curcontext" state line
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
16 typeset -A opt_args
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
17 local subcmds repos tags newFiles addedFiles
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
18
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
19 tags=($(hg tags | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//'))
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
20 subcmds=($(hg -v help | sed -e '1,/^list of commands:/d' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
21 -e '/^global options:/,$d' -e '/^ [^ ]/!d; s/[,:]//g;'))
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
22
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
23 if [[ $service == "hg" ]]; then
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
24 _arguments -C -A "-*" \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
25 '-R+[repository root directory]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
26 '-y[non-interactive]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
27 '-v[verbose]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
28 '-q[quiet]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
29 '--time[time how long the command takes]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
30 '--profile[profile]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
31 '-h-[display help and exit]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
32 '--version-[output version information and exit]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
33 '--cwd[change working directory]:new working directory:_files -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
34 '*::command:->subcmd' && return 0
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
35
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
36 if (( CURRENT == 1 )); then
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
37 _wanted commands expl 'hg command' compadd -a subcmds
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
38 return
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
39 fi
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
40 service="$words[1]"
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
41 curcontext="${curcontext%:*}=$service:"
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
42 fi
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
43
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
44 case $service in
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
45 (addremove)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
46 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
47 '-I[include path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
48 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
49 '*:directories:_files -/' # assume they want to add/remove a dir
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
50 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
51
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
52 (add)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
53 newFiles=( $(hg status -un) )
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
54 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
55 '-I[include path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
56 '-X[exclude path in search]:dir:_files -W $(hg root) -/'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
57 _wanted files expl 'unknown files' compadd -a newFiles
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
58 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
59
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
60 (remove|rm)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
61 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
62 '-I[include path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
63 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
64 '*:file:_files'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
65 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
66
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
67 (cat)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
68 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
69 '-I[include path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
70 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
71 '-o[output to file]:file:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
72 '-r[revision]:revision:($tags)' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
73 '*:file:_files'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
74 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
75
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
76 (checkout|update|up|co)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
77 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
78 '-b[checkout the head of a specific branch]:tag:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
79 '-m[allow merging of conflicts]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
80 '-C[overwrite locally modified files]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
81 '*:revision:->revs'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
82 _wanted revs expl 'revision or tag' compadd -a tags
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
83 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
84
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
85 (commit|ci)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
86 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
87 '-I[include path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
88 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
89 '-A[run addremove during commit]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
90 '-m[commit message]:string:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
91 '-d[date code]:string:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
92 '-u[user]:string:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
93 '*:file:_files'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
94 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
95
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
96 (tag)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
97 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
98 '-l[make the tag local]:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
99 '-m[commit message]:string:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
100 '-d[date code]:string:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
101 '-u[user]:string:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
102 '*:name and revision:'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
103 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
104
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
105 (clone)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
106 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
107 '-U[skip update after cloning]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
108 '-e[ssh command]:string:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
109 '--pull[use pull protocol to copy metadata]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
110 '--remotecmd[remote hg command]:command:->subcmd'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
111 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
112
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
113 (export)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
114 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
115 '-o[output to a file]:file:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
116 '-a-[tread all files as text]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
117 '*:revision:->revs'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
118 _wanted revs expl 'revision or tag' compadd -a tags
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
119 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
120
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
121 (heads)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
122 _arguments '-b[find branch info]'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
123 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
124
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
125 (outgoing|out)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
126 _arguments '-p[show patch]'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
127 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
128
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
129 (paths)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
130 _arguments '*:symbolic name:(default default-push)'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
131 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
132
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
133 (init)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
134 _arguments '*:new repo directory:_files -/'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
135 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
136
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
137 (unbundle)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
138 _arguments '*:changegroup file:_files'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
139 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
140
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
141 (manifest)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
142 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
143 '*:revision:->revs'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
144 _wanted revs expl 'revision or tag' compadd -a tags
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
145 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
146
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
147 (parents)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
148 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
149 '*:revision:->revs'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
150 _wanted revs expl 'revision or tag' compadd -a tags
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
151 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
152
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
153 (serve)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
154 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
155 '-A[access log file]:log file:_files' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
156 '-E[error log file]:log file:_files' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
157 '-p[listen port]:listen port:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
158 '-a[interface address]:interface address:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
159 '-n[repository name]:repository name:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
160 '--stdio[for remote clients]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
161 '-t[template directory]:template dir:_files -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
162 '--style[template style]:style' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
163 '-6[use IPv6 in addition to IPv4]'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
164 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
165
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
166 (pull)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
167 repos=( $(hg paths | sed -e 's/^.*= //') )
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
168 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
169 '-u[update working directory]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
170 '-e[ssh command]:remote commands:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
171 '--remotecmd[remote hg command]:command:->subcmd' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
172 '*:pull source:->repo'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
173 _wanted source expl 'source repository' compadd -a repos
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
174 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
175
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
176 (pull)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
177 repos=( $(hg paths | sed -e 's/^.*= //') )
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
178 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
179 '-f[force push]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
180 '-e[ssh command]:remote commands:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
181 '--remotecmd[remote hg command]:command:->subcmd' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
182 '*:pull source:->repo'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
183 _wanted source expl 'source repository' compadd -a repos
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
184 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
185
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
186 (id|identify)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
187 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
188
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
189 (recover)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
190 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
191
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
192 (rawcommit)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
193 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
194 '-p[parent]:revision:($tags)' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
195 '-d[date]:date:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
196 '-u[user]:user:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
197 '-F[file list]:file list:_files' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
198 '-m[commit message]:string:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
199 '-l[commit message file]:message file:_files -g *.txt' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
200 '*:files to commit:_files'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
201 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
202
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
203 (copy|cp)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
204 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
205 '-I[include path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
206 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
207 '-A-[record a copy after it has happened]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
208 '-f[replace destination if it exists]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
209 '-p[append source path to dest]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
210 '*:destination:'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
211 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
212
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
213 (rename|mv)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
214 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
215 '-I[include path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
216 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
217 '-A-[record a copy after it has happened]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
218 '-f[replace destination if it exists]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
219 '-p[append source path to dest]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
220 '*:destination:'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
221 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
222
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
223 (forget)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
224 addedFiles=( $(hg status -an) )
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
225 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
226 '-I[include path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
227 '-X[exclude path in search]:dir:_files -W $(hg root) -/'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
228 _wanted files expl 'newly added files' compadd -a addedFiles
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
229 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
230
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
231 (import|patch)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
232 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
233 '-p[path strip (default: 1)]:count:' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
234 '-f[skip check for outstanding changes]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
235 '-b[base path]:file:_files -W $(hg root)' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
236 '*:patch file:_files'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
237 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
238
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
239 (incoming|in)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
240 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
241 '-p[show patch]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
242 '*:mercurial repository:_files'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
243 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
244
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
245 (diff)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
246 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
247 '-I[include path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
248 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
249 '-r[revision]:revision:($tags)' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
250 '-a-[tread all files as text]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
251 '*:file:_files'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
252 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
253
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
254 (log|history)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
255 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
256 '-I[include path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
257 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
258 '-r[revision]:revision:($tags)' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
259 '-b[show branches]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
260 '-p[show patch]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
261 '*:file:_files'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
262 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
263
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
264 (grep)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
265 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
266 '-I[include path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
267 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
268 '-0[end fields with NUL]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
269 '--all[print all revisions with matches]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
270 '-i[ignore case]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
271 '-l[print names of files and revs with matches]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
272 '-n[print line numbers]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
273 '-r[search in revision rev]:revision:($tags)' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
274 '-u[print user who made change]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
275 '*:search pattern, then files:_files'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
276 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
277
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
278 (status)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
279 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
280 '-I[include path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
281 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
282 '-0[end filenames with NUL]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
283 '-m[show only modified files]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
284 '-a[show only added files]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
285 '-r[show only removed files]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
286 '-u[show only unknown files]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
287 '-n[hide status prefix]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
288 '*:search pattern, then files:_files'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
289 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
290
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
291 (locate)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
292 _arguments \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
293 '-r[search in revision rev]:revision:($tags)' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
294 '-0[end fields with NUL]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
295 '-f[print complete paths]' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
296 '-I[include path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
297 '-X[exclude path in search]:dir:_files -W $(hg root) -/' \
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
298 '*:search pattern:'
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
299 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
300
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
301 (help)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
302 _wanted commands expl 'hg command' compadd -a subcmds
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
303 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
304
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
305 (root|undo|view|verify|version)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
306 # no arguments for these commands
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
307 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
308
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
309 (*)
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
310 _message "unknown hg command completion: $service"
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
311 ;;
246e1a00af6f zsh completion function for hg
Steve Borho <steve@borho.org>
parents:
diff changeset
312 esac