1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-03 10:21:46 +02:00

Merge from HEAD of workers/2378{0,1,2,3}.

This commit is contained in:
Paul Ackersviller 2007-11-25 00:23:37 +00:00
parent 57cc145802
commit 1d77e36c39
6 changed files with 157 additions and 3 deletions

View file

@ -1,14 +1,32 @@
#compdef dput
_dput() {
_arguments \
'(-c --config)'{-c,--config}'[specify config file]:config file:_files' \
'(-d --debug)'{-d,--debug}'[debug mode]' \
'(-D --dinstall)'{-D,--dinstall}'[run dinstall after upload]' \
'(-e --delayed)'{-E,--delayed}'number of days in delayed queue:(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)' \
'(-f --force)'{-f,--force}'[force upload of already uploaded package]' \
'(-H --host-list)'{-H,--host-list}'[display host list]' \
'(-l --lintian)'{-l,--lintian}'[run lintian before upload]' \
'(-o --check-only)'{-o,--check-only}'[check the package, do not upload]' \
'(-p --print)'{-p,--print}'[print configuration]' \
'(-s --simulate)'{-s,--simulate}'[simulate an upload only]' \
'(-u --unchecked)'{-u,--unchecked}'[do not check GPG signature on the changes file]' \
'(-v --version)'{-v,--version}'[show version information]' \
'1::host:_dput_hosts' \
'*:changes file:_files -g "*.changes(-.)"'
}
_dput_hosts() {
local expl
if ( [[ ${+_dput_cfhosts} -eq 0 ]] || _cache_invalid dputhosts ) && ! _retrieve_cache dputhosts; then
_dput_cfhosts=(${${(M)${(f)"$(dput -H)"}:#*=>*}/ =>*/})
_store_cache dputhosts _dput_cfhosts
fi
_wanted dputhosts expl 'target host' compadd -a _dput_cfhosts
}
_dput "$@"

View file

@ -0,0 +1,12 @@
#compdef command
local ret
if [[ CURRENT -ge 3 ]]; then
compset -n 2
_normal && ret=0
else
_path_commands "$@" && ret=0
fi
return ret

View file

@ -0,0 +1,41 @@
#compdef hash rehash
local state line expl common_args curcontext="$curcontext" ret=1
typeset -A opt_args
common_args=( \
'-d[use named directory hash table]' \
'(-r -m -v)-f[rebuild hash table]' )
case ${service} in
hash)
_arguments -C -s -S \
'(-f -m -v)-r[empty hash table]' \
'(-f -r)-m[treat arguments as patterns]' \
'(-f -r -m)-v[list entries as they are added]' \
'(-f -r -v)-L[list in the form of calls to hash]' \
"${common_args[@]}" \
'(-d -f -r -m -v -L)*:hash:->hashval' && ret=0
;;
rehash)
_arguments -C -s ${common_args[@]} && return 0
;;
esac
if [[ $state = hashval ]]; then
if (( $+opt_args[-d] )); then
if compset -P 1 '*='; then
_wanted -C value files expl directories _path_files -/ && ret=0
else
_wanted -C name named-directories expl 'named directory' \
compadd -q -S '=' -k nameddirs && ret=0
fi
elif compset -P 1 '*='; then
_wanted -C value values expl 'executable file' _files -g '*(-*)' && ret=0
else
curcontext="${curcontext%:*}:name"
_path_commands -q -S '=' && ret=0
fi
fi
return ret

View file

@ -0,0 +1,39 @@
#compdef which whence where type
local farg aarg cargs args state line curcontext="$curcontext" ret=1
cargs=( \
'(-v -c)-w[print command type]' \
'-p[always do a path search]' \
'-m[treat the arguments as patterns]' \
'-s[print symlink free path as well]' \
'*:commands:->command' )
farg='-f[output contents of functions]'
aarg='-a[print all occurrences in path]'
case ${service} in
whence)
_arguments -C -s -A "-*" -S \
'(-c -w)-v[verbose output]' \
'(-v -w)-c[csh-like output]' \
"${cargs[@]}" "$farg" "$aarg" && ret=0
;;
where) _arguments -C -s -A "-*" -S "${cargs[@]}" && ret=0;;
which) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" && ret=0;;
type) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" "$farg" && ret=0;;
esac
if [[ "$state" = command ]]; then
args=( "$@" )
_alternative -O args \
'commands:external command:_path_commands' \
'builtins:builtin command:compadd -k builtins' \
'functions:shell function:compadd -k functions' \
'aliases:alias:compadd -k aliases' \
'reserved-words:reserved word:compadd -k reswords' && ret=0
fi
return ret

View file

@ -1,5 +1,3 @@
#compdef -equal-
local expl
_wanted commands expl command compadd -k commands
_path_commands

View file

@ -0,0 +1,46 @@
#autoload
# The option `-e' if given as the first argument says that we should
# complete only external commands and executable files. This and a
# `-' as the first argument is then removed from the arguments.
local args defs
zstyle -t ":completion:${curcontext}:commands" rehash && rehash
defs=(
'commands:external command:_path_commands'
)
[[ -n "$path[(r).]" || $PREFIX = */* ]] &&
defs=( "$defs[@]"
'executables:executable file or directory:_path_files -/g \*\(-\*\)'
)
if [[ "$1" = -e ]]; then
shift
else
[[ "$1" = - ]] && shift
defs=( "$defs[@]"
'builtins:builtin command:compadd -k builtins'
'functions:shell function:compadd -k functions'
'aliases:alias:compadd -k aliases'
'suffix-aliases:suffix alias:_suffix_alias_files'
'reserved-words:reserved word:compadd -k reswords'
'jobs:: _jobs -t'
'parameters:: _parameters -g "^*readonly*" -qS= -r "\n\t\- =["'
)
fi
args=( "$@" )
local -a cmdpath
if zstyle -a ":completion:${curcontext}" command-path cmdpath &&
[[ $#cmdpath -gt 0 ]]
then
local -a +h path
local -A +h commands
path=( $cmdpath )
fi
_alternative -O args "$defs[@]"