##// END OF EJS Templates
hg verify: add some bin to hex conversions
hg verify: add some bin to hex conversions

File last commit:

r1368:d1d605d1 default
r1384:d729850d default
Show More
zsh_completion
312 lines | 9.0 KiB | text/plain | TextLexer
Steve Borho
zsh completion function for hg
r1362 #compdef hg
# Zsh completion script for mercurial. Rename this file to _hg and copy
# it into your zsh function path (/usr/share/zsh/site-functions for
# instance)
#
# Copyright (C) 2005 Steve Borho
#
# This is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
local curcontext="$curcontext" state line
typeset -A opt_args
local subcmds repos tags newFiles addedFiles
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 tags=($(hg tags 2> /dev/null | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//'))
Steve Borho
zsh completion function for hg
r1362 subcmds=($(hg -v help | sed -e '1,/^list of commands:/d' \
-e '/^global options:/,$d' -e '/^ [^ ]/!d; s/[,:]//g;'))
if [[ $service == "hg" ]]; then
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 _arguments -C -A "-*" \
'-R+[repository root directory]' \
'-y[non-interactive]' \
'-v[verbose]' \
'-q[quiet]' \
'--time[time how long the command takes]' \
'--profile[profile]' \
'-h-[display help and exit]' \
'--version-[output version information and exit]' \
Steve Borho
zsh completion function for hg
r1362 '--cwd[change working directory]:new working directory:_files -/' \
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 '*::command:->subcmd' && return 0
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 if (( CURRENT == 1 )); then
_wanted commands expl 'hg command' compadd -a subcmds
return
fi
service="$words[1]"
curcontext="${curcontext%:*}=$service:"
Steve Borho
zsh completion function for hg
r1362 fi
case $service in
(addremove)
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 _arguments \
Steve Borho
zsh completion function for hg
r1362 '-I[include path in search]:dir:_files -W $(hg root) -/' \
'-X[exclude path in search]:dir:_files -W $(hg root) -/' \
'*:directories:_files -/' # assume they want to add/remove a dir
;;
(add)
newFiles=( $(hg status -un) )
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 _arguments \
Steve Borho
zsh completion function for hg
r1362 '-I[include path in search]:dir:_files -W $(hg root) -/' \
'-X[exclude path in search]:dir:_files -W $(hg root) -/'
_wanted files expl 'unknown files' compadd -a newFiles
;;
(remove|rm)
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 _arguments \
Steve Borho
zsh completion function for hg
r1362 '-I[include path in search]:dir:_files -W $(hg root) -/' \
'-X[exclude path in search]:dir:_files -W $(hg root) -/' \
'*:file:_files'
;;
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (cat)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '-I[include path in search]:dir:_files -W $(hg root) -/' \
'-X[exclude path in search]:dir:_files -W $(hg root) -/' \
'-o[output to file]:file:' \
'-r[revision]:revision:($tags)' \
'*:file:_files'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (checkout|update|up|co)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '-b[checkout the head of a specific branch]:tag:' \
'-m[allow merging of conflicts]' \
'-C[overwrite locally modified files]' \
'*:revision:->revs'
_wanted revs expl 'revision or tag' compadd -a tags
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (commit|ci)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '-I[include path in search]:dir:_files -W $(hg root) -/' \
'-X[exclude path in search]:dir:_files -W $(hg root) -/' \
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 '-A[run addremove during commit]' \
'-m[commit message]:string:' \
'-d[date code]:string:' \
'-u[user]:string:' \
Steve Borho
zsh completion function for hg
r1362 '*:file:_files'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (tag)
_arguments \
'-l[make the tag local]:' \
'-m[commit message]:string:' \
'-d[date code]:string:' \
'-u[user]:string:' \
Steve Borho
zsh completion function for hg
r1362 '*:name and revision:'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (clone)
_arguments \
'-U[skip update after cloning]' \
'-e[ssh command]:string:' \
'--pull[use pull protocol to copy metadata]' \
'--remotecmd[remote hg command]:command:->subcmd'
;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (export)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '-o[output to a file]:file:' \
'-a-[tread all files as text]' \
'*:revision:->revs'
_wanted revs expl 'revision or tag' compadd -a tags
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (heads)
_arguments '-b[find branch info]'
;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (outgoing|out)
_arguments '-p[show patch]'
Steve Borho
zsh completion function for hg
r1362 ;;
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (paths)
_arguments '*:symbolic name:(default default-push)'
;;
(init)
_arguments '*:new repo directory:_files -/'
;;
(unbundle)
Steve Borho
zsh completion function for hg
r1362 _arguments '*:changegroup file:_files'
;;
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (manifest)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '*:revision:->revs'
_wanted revs expl 'revision or tag' compadd -a tags
;;
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (parents)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '*:revision:->revs'
_wanted revs expl 'revision or tag' compadd -a tags
;;
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (serve)
Steve Borho
zsh completion function for hg
r1362 _arguments \
'-A[access log file]:log file:_files' \
'-E[error log file]:log file:_files' \
'-p[listen port]:listen port:' \
'-a[interface address]:interface address:' \
'-n[repository name]:repository name:' \
'--stdio[for remote clients]' \
'-t[template directory]:template dir:_files -/' \
'--style[template style]:style' \
'-6[use IPv6 in addition to IPv4]'
;;
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (pull)
Steve Borho
zsh completion function for hg
r1362 repos=( $(hg paths | sed -e 's/^.*= //') )
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 _arguments \
Steve Borho
zsh completion function for hg
r1362 '-u[update working directory]' \
'-e[ssh command]:remote commands:' \
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 '--remotecmd[remote hg command]:command:->subcmd' \
Steve Borho
zsh completion function for hg
r1362 '*:pull source:->repo'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 _wanted source expl 'source repository' compadd -a repos
Steve Borho
zsh completion function for hg
r1362 ;;
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (push)
Steve Borho
zsh completion function for hg
r1362 repos=( $(hg paths | sed -e 's/^.*= //') )
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 _arguments \
Steve Borho
zsh completion function for hg
r1362 '-f[force push]' \
'-e[ssh command]:remote commands:' \
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 '--remotecmd[remote hg command]:command:->subcmd' \
Steve Borho
zsh completion function for hg
r1362 '*:pull source:->repo'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 _wanted source expl 'source repository' compadd -a repos
Steve Borho
zsh completion function for hg
r1362 ;;
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (id|identify)
;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (recover)
;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (rawcommit)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '-p[parent]:revision:($tags)' \
'-d[date]:date:' \
'-u[user]:user:' \
'-F[file list]:file list:_files' \
'-m[commit message]:string:' \
'-l[commit message file]:message file:_files -g *.txt' \
'*:files to commit:_files'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (copy|cp)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '-I[include path in search]:dir:_files -W $(hg root) -/' \
'-X[exclude path in search]:dir:_files -W $(hg root) -/' \
'-A-[record a copy after it has happened]' \
'-f[replace destination if it exists]' \
'-p[append source path to dest]' \
'*:destination:'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (rename|mv)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '-I[include path in search]:dir:_files -W $(hg root) -/' \
'-X[exclude path in search]:dir:_files -W $(hg root) -/' \
'-A-[record a copy after it has happened]' \
'-f[replace destination if it exists]' \
'-p[append source path to dest]' \
'*:destination:'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (forget)
Steve Borho
zsh completion function for hg
r1362 addedFiles=( $(hg status -an) )
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 _arguments \
Steve Borho
zsh completion function for hg
r1362 '-I[include path in search]:dir:_files -W $(hg root) -/' \
'-X[exclude path in search]:dir:_files -W $(hg root) -/'
_wanted files expl 'newly added files' compadd -a addedFiles
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (import|patch)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '-p[path strip (default: 1)]:count:' \
'-f[skip check for outstanding changes]' \
'-b[base path]:file:_files -W $(hg root)' \
'*:patch file:_files'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (incoming|in)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '-p[show patch]' \
'*:mercurial repository:_files'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (diff)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '-I[include path in search]:dir:_files -W $(hg root) -/' \
'-X[exclude path in search]:dir:_files -W $(hg root) -/' \
'-r[revision]:revision:($tags)' \
'-a-[tread all files as text]' \
'*:file:_files'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (log|history)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '-I[include path in search]:dir:_files -W $(hg root) -/' \
'-X[exclude path in search]:dir:_files -W $(hg root) -/' \
'-r[revision]:revision:($tags)' \
'-b[show branches]' \
'-p[show patch]' \
'*:file:_files'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (grep)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '-I[include path in search]:dir:_files -W $(hg root) -/' \
'-X[exclude path in search]:dir:_files -W $(hg root) -/' \
'-0[end fields with NUL]' \
'--all[print all revisions with matches]' \
'-i[ignore case]' \
'-l[print names of files and revs with matches]' \
'-n[print line numbers]' \
'-r[search in revision rev]:revision:($tags)' \
'-u[print user who made change]' \
'*:search pattern, then files:_files'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (status)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '-I[include path in search]:dir:_files -W $(hg root) -/' \
'-X[exclude path in search]:dir:_files -W $(hg root) -/' \
'-0[end filenames with NUL]' \
'-m[show only modified files]' \
'-a[show only added files]' \
'-r[show only removed files]' \
'-u[show only unknown files]' \
'-n[hide status prefix]' \
'*:search pattern, then files:_files'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (locate)
_arguments \
Steve Borho
zsh completion function for hg
r1362 '-r[search in revision rev]:revision:($tags)' \
'-0[end fields with NUL]' \
'-f[print complete paths]' \
'-I[include path in search]:dir:_files -W $(hg root) -/' \
'-X[exclude path in search]:dir:_files -W $(hg root) -/' \
'*:search pattern:'
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 ;;
Steve Borho
zsh completion function for hg
r1362
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (help)
_wanted commands expl 'hg command' compadd -a subcmds
;;
Steve Borho
zsh completion function for hg
r1362
(root|undo|view|verify|version)
# no arguments for these commands
;;
Steve Borho
Fix completion function for 'hg pull'. Fix truncation bug and remove tabs.
r1368 (*)
_message "unknown hg command completion: $service"
;;
Steve Borho
zsh completion function for hg
r1362 esac