summaryrefslogtreecommitdiffstats
path: root/Completion
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-11-15 17:50:12 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-11-15 17:50:12 +0000
commit51f1c08fd7e9d4ae3acca8f84df0ce7f5a2fb9b4 (patch)
treea2ee082fe8859985b90c07e9608efb8670fe5d03 /Completion
parentFrank Terbeck: 27407: tmux switch-client completion (diff)
downloadzsh-51f1c08fd7e9d4ae3acca8f84df0ce7f5a2fb9b4.tar
zsh-51f1c08fd7e9d4ae3acca8f84df0ce7f5a2fb9b4.tar.gz
zsh-51f1c08fd7e9d4ae3acca8f84df0ce7f5a2fb9b4.tar.bz2
zsh-51f1c08fd7e9d4ae3acca8f84df0ce7f5a2fb9b4.tar.lz
zsh-51f1c08fd7e9d4ae3acca8f84df0ce7f5a2fb9b4.tar.xz
zsh-51f1c08fd7e9d4ae3acca8f84df0ce7f5a2fb9b4.tar.zst
zsh-51f1c08fd7e9d4ae3acca8f84df0ce7f5a2fb9b4.zip
c.f. 27408: remove _mercurial and put back some 2> /dev/null
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/.distfiles1
-rw-r--r--Completion/Unix/Command/_hg20
-rw-r--r--Completion/Unix/Command/_mercurial873
3 files changed, 10 insertions, 884 deletions
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index 849b34d03..c42239a46 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -117,7 +117,6 @@ _make
_man
_md5sum
_mencal
-_mercurial
_metaflac
_mh
_mkdir
diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg
index ef124ef6e..aeb64f660 100644
--- a/Completion/Unix/Command/_hg
+++ b/Completion/Unix/Command/_hg
@@ -166,7 +166,7 @@ _hg_tags() {
typeset -a tags
local tag rev
- _hg_cmd tags | while read tag
+ _hg_cmd tags 2> /dev/null | while read tag
do
tags+=(${tag/ # [0-9]#:*})
done
@@ -205,7 +205,7 @@ _hg_files() {
_hg_status() {
[[ -d $PREFIX ]] || PREFIX=$PREFIX:h
- status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX)"})
+ status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX 2>/dev/null)"})
}
_hg_unknown() {
@@ -231,7 +231,7 @@ _hg_resolve() {
[[ -d $PREFIX ]] || PREFIX=$PREFIX:h
- _hg_cmd resolve -l ./$PREFIX | while read rstate rpath
+ _hg_cmd resolve -l ./$PREFIX 2> /dev/null | while read rstate rpath
do
[[ $rstate == 'R' ]] && resolved_files+=($rpath)
[[ $rstate == 'U' ]] && unresolved_files+=($rpath)
@@ -275,7 +275,7 @@ _hg_ssh_urls() {
compset -P '*/'
if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid"
then
- remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}")"}##*/}%/})
+ remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}" 2> /dev/null)"}##*/}%/})
_store_cache "$cacheid" remdirs
fi
_describe -t directories 'remote directory' remdirs -S/
@@ -313,7 +313,7 @@ _hg_urls() {
_hg_paths() {
typeset -a paths pnames
- _hg_cmd paths | while read -A pnames
+ _hg_cmd paths 2> /dev/null | while read -A pnames
do
paths+=($pnames[1])
done
@@ -772,13 +772,13 @@ _hg_cmd_view() {
# MQ
_hg_qseries() {
typeset -a patches
- patches=(${(f)"$(_hg_cmd qseries)"})
+ patches=(${(f)"$(_hg_cmd qseries 2> /dev/null)"})
(( $#patches )) && _describe -t hg-patches 'patches' patches
}
_hg_qapplied() {
typeset -a patches
- patches=(${(f)"$(_hg_cmd qapplied)"})
+ patches=(${(f)"$(_hg_cmd qapplied 2> /dev/null)"})
if (( $#patches ))
then
patches+=(qbase qtip)
@@ -788,14 +788,14 @@ _hg_qapplied() {
_hg_qunapplied() {
typeset -a patches
- patches=(${(f)"$(_hg_cmd qunapplied)"})
+ patches=(${(f)"$(_hg_cmd qunapplied 2> /dev/null)"})
(( $#patches )) && _describe -t hg-unapplied-patches 'unapplied patches' patches
}
# unapplied, including guarded patches
_hg_qdeletable() {
typeset -a unapplied
- unapplied=(${(f)"$(_hg_cmd qseries)"})
+ unapplied=(${(f)"$(_hg_cmd qseries 2> /dev/null)"})
for p in $(_hg_cmd qapplied)
do
unapplied=(${unapplied:#$p})
@@ -808,7 +808,7 @@ _hg_qguards() {
typeset -a guards
local guard
compset -P "+|-"
- _hg_cmd qselect -s | while read guard
+ _hg_cmd qselect -s 2> /dev/null | while read guard
do
guards+=(${guard#(+|-)})
done
diff --git a/Completion/Unix/Command/_mercurial b/Completion/Unix/Command/_mercurial
deleted file mode 100644
index d848faa0b..000000000
--- a/Completion/Unix/Command/_mercurial
+++ /dev/null
@@ -1,873 +0,0 @@
-#compdef hg
-
-emulate -LR zsh
-setopt extendedglob
-
-local curcontext="$curcontext" state line
-typeset -A _hg_cmd_globals
-
-_hg() {
- local cmd _hg_root
- integer i=2
- _hg_cmd_globals=()
-
- while (( i < $#words ))
- do
- case "$words[$i]" in
- -R|--repository)
- eval _hg_root="$words[$i+1]"
- _hg_cmd_globals+=("$words[$i]" "$_hg_root")
- (( i += 2 ))
- continue
- ;;
- -R*)
- _hg_cmd_globals+="$words[$i]"
- eval _hg_root="${words[$i]#-R}"
- (( i++ ))
- continue
- ;;
- --cwd|--config)
- # pass along arguments to hg completer
- _hg_cmd_globals+=("$words[$i]" "$words[$i+1]")
- (( i += 2 ))
- continue
- ;;
- -*)
- # skip option
- (( i++ ))
- continue
- ;;
- esac
- if [[ -z "$cmd" ]]
- then
- cmd="$words[$i]"
- words[$i]=()
- (( CURRENT-- ))
- fi
- (( i++ ))
- done
-
- if [[ -z "$cmd" ]]
- then
- _arguments -s -w : $_hg_global_opts \
- ':mercurial command:_hg_commands'
- return
- fi
-
- # resolve abbreviations and aliases
- if ! (( $+functions[_hg_cmd_${cmd}] ))
- then
- local cmdexp
- (( $#_hg_cmd_list )) || _hg_get_commands
-
- cmdexp=$_hg_cmd_list[(r)${cmd}*]
- if [[ $cmdexp == $_hg_cmd_list[(R)${cmd}*] ]]
- then
- # might be nice to rewrite the command line with the expansion
- cmd="$cmdexp"
- fi
- if [[ -n $_hg_alias_list[$cmd] ]]
- then
- cmd=$_hg_alias_list[$cmd]
- fi
- fi
-
- curcontext="${curcontext%:*:*}:hg-${cmd}:"
-
- zstyle -s ":completion:$curcontext:" cache-policy update_policy
-
- if [[ -z "$update_policy" ]]
- then
- zstyle ":completion:$curcontext:" cache-policy _hg_cache_policy
- fi
-
- if (( $+functions[_hg_cmd_${cmd}] ))
- then
- _hg_cmd_${cmd}
- else
- # complete unknown commands normally
- _arguments -s -w : $_hg_global_opts \
- '*:files:_hg_files'
- fi
-}
-
-_hg_cache_policy() {
- typeset -a old
-
- # cache for a minute
- old=( "$1"(mm+10) )
- (( $#old )) && return 0
-
- return 1
-}
-
-_hg_get_commands() {
- typeset -ga _hg_cmd_list
- typeset -gA _hg_alias_list
- local hline cmd cmdalias
- _call_program help hg --verbose help | while read -A hline
- do
- cmd="$hline[1]"
- case $cmd in
- *:)
- cmd=${cmd%:}
- _hg_cmd_list+=($cmd)
- ;;
- *,)
- cmd=${cmd%,}
- _hg_cmd_list+=($cmd)
- integer i=2
- while (( i <= $#hline ))
- do
- cmdalias=${hline[$i]%(:|,)}
- _hg_cmd_list+=($cmdalias)
- _hg_alias_list+=($cmdalias $cmd)
- (( i++ ))
- done
- ;;
- esac
- done
-}
-
-_hg_commands() {
- (( $#_hg_cmd_list )) || _hg_get_commands
- _describe -t commands 'mercurial command' _hg_cmd_list
-}
-
-_hg_revrange() {
- compset -P 1 '*:'
- _hg_tags "$@"
-}
-
-_hg_tags() {
- typeset -a tags
- local tag rev
-
- _hg_cmd tags 2> /dev/null | while read tag
- do
- tags+=(${tag/ # [0-9]#:*})
- done
- (( $#tags )) && _describe -t tags 'tags' tags
-}
-
-_hg_files() {
- if [[ -n "$_hg_root" ]]
- then
- [[ -d "$_hg_root/.hg" ]] || return
- case "$_hg_root" in
- /*)
- _files -W $_hg_root
- ;;
- *)
- _files -W $PWD/$_hg_root
- ;;
- esac
- else
- _files
- fi
-}
-
-_hg_status() {
- [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
- status_files=(${(ps:\0:)"$(_hg_cmd status -0n$1 ./$PREFIX 2>/dev/null)"})
-}
-
-_hg_unknown() {
- typeset -a status_files
- _hg_status u
- _wanted files expl 'unknown files' _multi_parts / status_files
-}
-
-_hg_missing() {
- typeset -a status_files
- _hg_status d
- _wanted files expl 'missing files' _multi_parts / status_files
-}
-
-_hg_modified() {
- typeset -a status_files
- _hg_status m
- _wanted files expl 'modified files' _multi_parts / status_files
-}
-
-_hg_resolve() {
- local rstate rpah
-
- [[ -d $PREFIX ]] || PREFIX=$PREFIX:h
-
- _hg_cmd resolve -l ./$PREFIX 2> /dev/null | while read rstate rpath
- do
- [[ $rstate == 'R' ]] && resolved_files+=($rpath)
- [[ $rstate == 'U' ]] && unresolved_files+=($rpath)
- done
-}
-
-_hg_resolved() {
- typeset -a resolved_files unresolved_files
- _hg_resolve
- _wanted files expl 'resolved files' _multi_parts / resolved_files
-}
-
-_hg_unresolved() {
- typeset -a resolved_files unresolved_files
- _hg_resolve
- _wanted files expl 'unresolved files' _multi_parts / unresolved_files
-}
-
-_hg_config() {
- typeset -a items
- items=(${${(%f)"$(_call_program hg hg showconfig)"}%%\=*})
- (( $#items )) && _describe -t config 'config item' items
-}
-
-_hg_addremove() {
- _alternative 'files:unknown files:_hg_unknown' \
- 'files:missing files:_hg_missing'
-}
-
-_hg_ssh_urls() {
- if [[ -prefix */ ]]
- then
- if zstyle -T ":completion:${curcontext}:files" remote-access
- then
- local host=${PREFIX%%/*}
- typeset -a remdirs
- compset -p $(( $#host + 1 ))
- local rempath=${(M)PREFIX##*/}
- local cacheid="hg:${host}-${rempath//\//_}"
- cacheid=${cacheid%[-_]}
- compset -P '*/'
- if _cache_invalid "$cacheid" || ! _retrieve_cache "$cacheid"
- then
- remdirs=(${${(M)${(f)"$(_call_program files ssh -a -x $host ls -1FL "${(q)rempath}" 2> /dev/null)"}##*/}%/})
- _store_cache "$cacheid" remdirs
- fi
- _describe -t directories 'remote directory' remdirs -S/
- else
- _message 'remote directory'
- fi
- else
- if compset -P '*@'
- then
- _hosts -S/
- else
- _alternative 'hosts:remote host name:_hosts -S/' \
- 'users:user:_users -S@'
- fi
- fi
-}
-
-_hg_urls() {
- if compset -P bundle://
- then
- _files
- elif compset -P ssh://
- then
- _hg_ssh_urls
- elif [[ -prefix *: ]]
- then
- _urls
- else
- local expl
- compset -S '[^:]*'
- _wanted url-schemas expl 'URL schema' compadd -S '' - \
- http:// https:// ssh:// bundle://
- fi
-}
-
-_hg_paths() {
- typeset -a paths pnames
- _hg_cmd paths 2> /dev/null | while read -A pnames
- do
- paths+=($pnames[1])
- done
- (( $#paths )) && _describe -t path-aliases 'repository alias' paths
-}
-
-_hg_remote() {
- _alternative 'path-aliases:repository alias:_hg_paths' \
- 'directories:directory:_files -/' \
- 'urls:URL:_hg_urls'
-}
-
-_hg_clone_dest() {
- _alternative 'directories:directory:_files -/' \
- 'urls:URL:_hg_urls'
-}
-
-# Common options
-_hg_global_opts=(
- '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/'
- '--cwd[change working directory]:new working directory:_files -/'
- '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]'
- '(--verbose -v)'{-v,--verbose}'[enable additional output]'
- '*--config[set/override config option]:defined config items:_hg_config'
- '(--quiet -q)'{-q,--quiet}'[suppress output]'
- '(--help -h)'{-h,--help}'[display help and exit]'
- '--debug[debug mode]'
- '--debugger[start debugger]'
- '--encoding[set the charset encoding (default: UTF8)]'
- '--encodingmode[set the charset encoding mode (default: strict)]'
- '--lsprof[print improved command execution profile]'
- '--traceback[print traceback on exception]'
- '--time[time how long the command takes]'
- '--profile[profile]'
- '--version[output version information and exit]'
-)
-
-_hg_pat_opts=(
- '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/'
- '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/')
-
-_hg_diff_opts=(
- '(--text -a)'{-a,--text}'[treat all files as text]'
- '(--git -g)'{-g,--git}'[use git extended diff format]'
- "--nodates[don't include dates in diff headers]")
-
-_hg_dryrun_opts=(
- '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
-
-_hg_style_opts=(
- '--style[display using template map file]:'
- '--template[display with template]:')
-
-_hg_commit_opts=(
- '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
- '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:'
- '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files')
-
-_hg_remote_opts=(
- '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:'
- '--remotecmd[specify hg command to run on the remote side]:')
-
-_hg_cmd() {
- _call_program hg hg "$_hg_cmd_globals[@]" "$@"
-}
-
-_hg_cmd_add() {
- _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
- '*:unknown files:_hg_unknown'
-}
-
-_hg_cmd_addremove() {
- _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
- '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \
- '*:unknown or missing files:_hg_addremove'
-}
-
-_hg_cmd_annotate() {
- _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
- '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \
- '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
- '(--text -a)'{-a,--text}'[treat all files as text]' \
- '(--user -u)'{-u,--user}'[list the author]' \
- '(--date -d)'{-d,--date}'[list the date]' \
- '(--number -n)'{-n,--number}'[list the revision number (default)]' \
- '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
- '*:files:_hg_files'
-}
-
-_hg_cmd_archive() {
- _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
- '--no-decode[do not pass files through decoders]' \
- '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
- '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \
- '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
- '*:destination:_files'
-}
-
-_hg_cmd_backout() {
- _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
- '--merge[merge with old dirstate parent after backout]' \
- '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
- '--parent[parent to choose when backing out merge]' \
- '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
- '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
- '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
- '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt'
-}
-
-_hg_cmd_bundle() {
- _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
- '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
- '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_tags' \
- ':output file:_files' \
- ':destination repository:_files -/'
-}
-
-_hg_cmd_cat() {
- _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
- '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
- '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
- '*:file:_hg_files'
-}
-
-_hg_cmd_clone() {
- _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
- '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \
- '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \
- '--uncompressed[use uncompressed transfer (fast over LAN)]' \
- ':source repository:_hg_remote' \
- ':destination:_hg_clone_dest'
-}
-
-_hg_cmd_commit() {
- _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
- '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
- '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
- '(--logfile -l)'{-l+,--logfile}'[read commit message from <file>]:log file:_files -g \*.txt' \
- '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
- '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \
- '*:file:_hg_files'
-}
-
-_hg_cmd_copy() {
- _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
- '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \
- '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
- '*:file:_hg_files'
-}
-
-_hg_cmd_diff() {
- typeset -A opt_args
- _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
- '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \