diff options
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | Completion/Debian/Command/_apt-file | 100 | ||||
-rw-r--r-- | Completion/Debian/Command/_dak | 31 | ||||
-rw-r--r-- | Completion/Debian/Command/_dpkg-buildpackage | 2 | ||||
-rw-r--r-- | Completion/Debian/Command/_dpkg-repack | 2 | ||||
-rw-r--r-- | Completion/Debian/Command/_lintian | 2 | ||||
-rw-r--r-- | Completion/Debian/Command/_madison | 2 | ||||
-rw-r--r-- | Completion/Debian/Command/_pbuilder | 4 | ||||
-rw-r--r-- | Completion/Debian/Command/_reprepro | 25 | ||||
-rw-r--r-- | Completion/Debian/Command/_svn-buildpackage | 4 | ||||
-rw-r--r-- | Completion/Debian/Type/_deb_architectures | 9 | ||||
-rw-r--r-- | Completion/Unix/Command/_runit | 73 | ||||
-rw-r--r-- | Completion/Unix/Command/_xxd | 45 | ||||
-rw-r--r-- | Completion/X/Command/_xautolock | 25 | ||||
-rw-r--r-- | Completion/Zsh/Command/_zmodload | 42 |
15 files changed, 284 insertions, 104 deletions
diff --git a/ChangeLog b/ChangeLog index 33089abdc..d5dc0ac4b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,28 @@ for the temporary HISTSIZE and SAVEHIST of "fc -p", and fix crash on zero values for same +2014-10-11 Oliver Kiddle <opk@zsh.org> + + * 33424: Completion/Debian/Type/_deb_architectures, + Completion/Debian/Command/_apt-file, + Completion/Debian/Command/_dak, Completion/Debian/Command/_madison, + Completion/Debian/Command/_dpkg-buildpackage, + Completion/Debian/Command/_pbuilder, + Completion/Debian/Command/_reprepro, + Completion/Debian/Command/_svn-buildpackage: use common function + for completing Debian architectures + +2014-10-10 Oliver Kiddle <opk@zsh.org> + + * 33420: Completion/Zsh/Command/_zmodload: complete -R/-m options and + fix feature completion + + * fREW Schmidt: 33375: Completion/Unix/Command/_runit: sv completion + + * Daniel Shahaf: 33396: Completion/Unix/Command/_xxd: new completion + + * Yuri D'Elia: 33397: Completion/X/Command/_xautolock: new completion + 2014-10-09 Frank Terbeck <ft@bewatermyfriend.org> * 33405: Functions/VCS_Info/vcs_info: Make sure maxexports diff --git a/Completion/Debian/Command/_apt-file b/Completion/Debian/Command/_apt-file index eddbbdcf5..98a93fdd3 100644 --- a/Completion/Debian/Command/_apt-file +++ b/Completion/Debian/Command/_apt-file @@ -1,55 +1,59 @@ #compdef apt-file -_apt-file() { - local -a arguments - local state line cmds - arguments=( - '(--cache -c)'{--cache,-c}'[cache directory]:directory:_directories' - '(-v --verbose)'{-v,--verbose}'[verbose]' - '(--cdrom-mount -d)'{--cdrom-mount,-d}'[cdrom mount point]:directory:_directories' - '(--ignore-case -i)'{--ignore-case,-i}'[ignore case]' - '(--regexp -r)'{--regexp,-r}'[regular expression]' - '(-V --version)'{-V,--version}'[version]' - '(-a --architecture)'{-a,--architecture}'[architecture]:architecture:(alpha arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc)' - '(-s --sources-list)'{-s,--sources-list}'[source.list file]:file:_files' - '(-l --package-only)'{-l,--package-only}'[only display package name]' - '(-F --fixed-string)'{-F,--fixed-string}'[do not expand search pattern]' - '(-y --dummy)'{-y,--dummy}'[run in dummy mode]' - '(-h --help)'{-h,--help}'[display help screen]' - '1: :->cmds' - '*: :->args' - ) - _arguments -S $arguments +local curcontext="$curcontext" state line expl cmds ret=1 +typeset -A opt_args - case $state in - cmds) - cmds=( - 'update:resynchronize package contents' - 'search:search in which package file is included' - 'list:list contents of a package' - 'show:alias for list' - 'purge:remove all Contents-<ARCH>.gz files in cache directory' - ) - _describe -t commands 'apt-list command' cmds && ret=0 +_arguments -C -S \ + '(--cache -c)'{--cache,-c}'[cache directory]:directory:_directories' \ + '(-v --verbose)'{-v,--verbose}'[verbose]' \ + '(--cdrom-mount -d)'{--cdrom-mount,-d}'[cdrom mount point]:directory:_directories' \ + '(--from-file -f --from-deb -D)'{--from-file,-f}'[read patterns from given file]' \ + '(--from-deb -D --from-file -f)'{--from-dev,-D}'[use contents of given .deb archives as patterns]' \ + '(--ignore-case -i)'{--ignore-case,-i}'[ignore case]' \ + '(--regexp -x)'{--regexp,-x}'[regular expression]' \ + '(-V --version)'{-V,--version}'[version]' \ + '(-a --architecture)'{-a,--architecture}'[architecture]:architecture:_deb_architectures' \ + '(-s --sources-list)'{-s,--sources-list}'[source.list file]:file:_files' \ + '(-l --package-only)'{-l,--package-only}'[only display package name]' \ + '(-N --non-interactive)'{-N,--non-interactive}'[skip schemes requiring user input]' \ + '(-F --fixed-string)'{-F,--fixed-string}'[do not expand search pattern]' \ + '(-y --dummy)'{-y,--dummy}'[run in dummy mode]' \ + '(-)'{-h,--help}'[display help screen]' \ + '1: :->cmds' \ + '*: :->args' && ret=0 + +case $state in + cmds) + cmds=( + 'update:resynchronize package contents' + {find,search}:'search in which package file is included' + {list,show}:'list contents of a package' + 'purge:remove all Contents-<ARCH>.gz files in cache directory' + ) + _describe -t commands 'apt-list command' cmds + ;; + args) + case $line[1] in + search|find) + if (( $#opt_args[(I)(-D|--from-deb)] )); then + _wanted files expl 'debian package' _files -g '*.deb(-.)' + elif (( $#opt_args[(I)(-f|--from-file)] )); then + _files + else + _message -e patterns "pattern" + fi + ;; + list|show) + _deb_packages avail ;; - args) - case $line[1] in - search) - _message "pattern" - ;; - list|show) - _deb_packages avail - ;; - update|purge) - # do nothing - ;; - *) - _message "command $line[1] not available" - ;; - esac + update|purge) + # do nothing + ;; + *) + _message "command $line[1] not available" ;; esac + ;; +esac && ret=0 -} - -_apt-file "$@" +return ret diff --git a/Completion/Debian/Command/_dak b/Completion/Debian/Command/_dak index 840fc0017..086196c4a 100644 --- a/Completion/Debian/Command/_dak +++ b/Completion/Debian/Command/_dak @@ -1,31 +1,26 @@ #compdef dak -local curcontext="$curcontext" state line expl cmd args ret=1 -typeset -A opt_args +local expl cmd args ret=1 -_arguments -C \ - '1: :->cmd' \ - '*:: :->args' && ret=0 - -if (( ! $+_dak_cmds )); then +if (( CURRENT == 2 )); then + if (( ! $+_dak_cmds )); then typeset -gH _dak_cmds _dak_cmds=(${${${(f)${"$(_call_program dak dak --help)"#*Availa#ble commands:}}#[^a-z] ##}%%[ ]*}) -fi + fi -if [[ $state != 'args' ]]; then - _describe -t subcommand 'subcommand' _dak_cmds - return 0 + _describe -t subcommands 'subcommand' _dak_cmds + return fi -cmd="$words[1]" -curcontext="${curcontext%:*:*}:dak-$cmd:" +cmd="$words[2]" +local curcontext="${curcontext%:*:*}:dak-$cmd:" args=( '(-)'{--help,-h}'[show help message]' ) case $cmd in (ls) args+=( - '(-a --architecture)'{-a,--architecture=}':arch:_values -s , "architecture list" source all alpha amd64 arm hppa hurd-i386 i386 ia64 mips mipsel' + '(-a --architecture)'{-a,--architecture=}':arch:_sequence _deb_architectures -a "all source"' '(-b --binary-type)'{-b,--binary-type=}':type:(deb udeb)' '(-c --component)'{-c,--component=}':component:_values -s , "component list" main contrib non-free' '(-g --greaterorequal)'{-g,--greaterorequal} @@ -70,7 +65,7 @@ case $cmd in ;; (rm) args+=( - '(-a --architecture)'{-a,--architecture=}':arch:_values -s , "architecture list" source all alpha amd64 arm hppa hurd-i386 i386 ia64 mips mipsel' + '(-a --architecture)'{-a,--architecture=}':arch:_sequence _deb_architectures -a "all source"' '(-b --binary)'{-b,--binary}'[remove binaries only]' '(-c --component)'{-c,--component=}':component:_values -s , "component list" main contrib non-free' '(-C --carbon-copy)'{-C,--carbon-copy=}':cc address:_email_addresses' @@ -96,7 +91,7 @@ case $cmd in (make-suite-file-list) args+=( - '(-a --architecture)'{-a,--architecture=}':arch:_values -s , "architecture list" source all alpha amd64 arm hppa hurd-i386 i386 ia64 mips mipsel' + '(-a --architecture)'{-a,--architecture=}':arch:_sequence _deb_architectures -a "all source"' '(-c --component)'{-c,--component=}':component:_values -s , "component list" main contrib non-free' '(-n --no-delete)'{-n,--no-delete}'[do not delete older versions]' '(-s --suite)'{-s,--suite=}':suite:_values -s , "suite list" oldstable stable testing unstable experimental' @@ -239,10 +234,10 @@ case $cmd in ;; (*) - _files + args+=( '*: :_default' ) ;; esac _arguments -s "$args[@]" && ret=0 -return $ret +return ret diff --git a/Completion/Debian/Command/_dpkg-buildpackage b/Completion/Debian/Command/_dpkg-buildpackage index d6f5c5f0a..b0eea5783 100644 --- a/Completion/Debian/Command/_dpkg-buildpackage +++ b/Completion/Debian/Command/_dpkg-buildpackage @@ -5,7 +5,7 @@ _arguments \ '-B[binary-only build, no source or arch-indep binaries]' \ '-S[source-only build, no binaries]' \ '-s-:source generation:((i\:default a\:force\ inclusion\ of\ original\ source d\:force\ exclusion\ of\ original\ source))' \ - '-a-:architecture:(alpha amd64 arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc)' \ + '-a-:architecture:_deb_architectures' \ '-v-:version:' \ '-C-:changes description:_files' \ '-m-:maintainer address:_email_addresses' \ diff --git a/Completion/Debian/Command/_dpkg-repack b/Completion/Debian/Command/_dpkg-repack index 5d625a5ce..37f800516 100644 --- a/Completion/Debian/Command/_dpkg-repack +++ b/Completion/Debian/Command/_dpkg-repack @@ -2,6 +2,6 @@ _arguments \ '--root=[take package from filesystem rooted on <dir>]:root dir:_files -/' \ - '--arch=[force the package to be built for architecture <arch>]:architecture:(alpha amd64 arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc)' \ + '--arch=[force the package to be built for specified architecture]:architecture:_deb_architectures' \ '--generate[generate build directory but do not build deb]' \ '*:package:_deb_packages xinstalled' diff --git a/Completion/Debian/Command/_lintian b/Completion/Debian/Command/_lintian index 554be4550..773e7a182 100644 --- a/Completion/Debian/Command/_lintian +++ b/Completion/Debian/Command/_lintian @@ -31,7 +31,7 @@ case "$service" in '--archivedir:archive directory:_files -/' \ '--dist:distribution:(woody sarge sid)' \ '--section:release:(main contrib non-free)' \ - '--arch:architecture:(alpha arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc)' \ + '--arch:architecture:_deb_architectures' \ '--root:root directory:_files -/' \ '(-a --all)'{-a,--all}'[check all packages in the distribution]' \ '(-b --binary)'{-b,--binary}'[the following packages are binary]' \ diff --git a/Completion/Debian/Command/_madison b/Completion/Debian/Command/_madison index fc4821e91..445b79a45 100644 --- a/Completion/Debian/Command/_madison +++ b/Completion/Debian/Command/_madison @@ -1,7 +1,7 @@ #compdef madison rmadison _arguments \ - '(-a --architecture)'{-a,--architecture=}':arch:_values -s , "architecture list" source all alpha arm hppa hurd-i386 i386 ia64 mips mipsel' \ + '(-a --architecture)'{-a,--architecture=}':arch:_sequence _deb_architectures -a "all source" -' \ '(-b --binary)'{-b,--binary-type=}':type:(deb udeb)' \ '(-c --component)'{-c,--component=}':component:_values -s , "component list" main contrib non-free' \ '(-g --greaterorequal)'{-g,--greaterorequal} \ diff --git a/Completion/Debian/Command/_pbuilder b/Completion/Debian/Command/_pbuilder index 7811d567b..9322d036a 100644 --- a/Completion/Debian/Command/_pbuilder +++ b/Completion/Debian/Command/_pbuilder @@ -14,8 +14,8 @@ else '--buildresult:location:_files -/' \ '--mirror:URL:_urls' \ '--othermirror:URL:_urls' \ - '--distribution:suite:(breezy dapper edgy etch feisty gutsy hardy hoary intrepid jaunty karmic lenny lucid potato sarge sid squeeze warty woody' \ - '--architecture:architecture:(alpha amd64 armel hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc)' \ + '--distribution:suite:(breezy dapper edgy etch feisty gutsy hardy hoary intrepid jaunty jessie karmic lenny lucid potato sarge sid squeeze warty woody' \ + '--architecture:architecture:i_deb_architectures' \ '--components:component:(main contrib non-free)' \ '--override-config' \ '--hookdir:location:_files -/' \ diff --git a/Completion/Debian/Command/_reprepro b/Completion/Debian/Command/_reprepro index 44ed1548c..d1e124eef 100644 --- a/Completion/Debian/Command/_reprepro +++ b/Completion/Debian/Command/_reprepro @@ -1,10 +1,10 @@ #compdef reprepro -local context state line distfile +local curcontext="$curcontext" state line expl distfile ret=1 typeset -A opt_args local -a codenames -_arguments \ +_arguments -C \ '(-h --help)'{-h,--help}'[display help]' \ '*'{-v,-V,--verbose}'[be more verbose]' \ '--silent[be less verbose]' \ @@ -17,7 +17,7 @@ _arguments \ '--listdir:list dir:_files -/' \ '--methoddir:method dir:_files -/' \ '(-C --component)'{-C,--component}':component:(component1 component2)' \ - '(-A --architecture)'{-A,--architecture}':architecture:(amd64 sparc)' \ + '(-A --architecture)'{-A,--architecture}':architecture:_sequence -s "|" _deb_architectures -' \ '(-T --type)'{-T,--type}':file type:(dsc deb udeb)' \ '(-S --section)'{-S,--section}':section:(section1 section2)' \ '(-P --priority)'{-P,--priority}':priority:(high low)' \ @@ -40,12 +40,11 @@ _arguments \ rereference dumpreferences dumpunreferenced deleteunreferenced reoverride dumptracks retrack removealltracks removetrack tidytracks copy clearvanished gensnapshot rerunnotifiers)' \ - '*::subcmd:->subcmd' && return 0 + '*::subcmd:->subcmd' && ret=0 case "$state" in - (subcmd) - - case "$words[1]" in + subcmd) + case "$words[1]" in (export|update|iteratedupdate|checkupdate|predelete|pull|checkpull|check) if [[ -n "$opt_args[--confdir]" ]]; then distfile=${opt_args[--confdir]}/distributions @@ -60,11 +59,13 @@ case "$state" in fi codenames=($(awk '/^[Cc][Oo][Dd][Ee][Nn][Aa][Mm][Ee]: / {$1="";print}' "$distfile")) - _wanted -V 'codenames' expl 'codename' compadd -a codenames - ;; + _wanted -V 'codenames' expl 'codename' compadd -a codenames && ret=0 + ;; (*) - _files - ;; - esac + _files && ret=0 + ;; + esac ;; esac + +return ret diff --git a/Completion/Debian/Command/_svn-buildpackage b/Completion/Debian/Command/_svn-buildpackage index 0b4d50125..e0f925896 100644 --- a/Completion/Debian/Command/_svn-buildpackage +++ b/Completion/Debian/Command/_svn-buildpackage @@ -28,8 +28,8 @@ _arguments \ '-B[binary-only build, no source or arch-indep binaries]' \ '-S[source-only build, no binaries]' \ '-s-:source generation:((i\:default a\:force\ inclusion\ of\ original\ source d\:force\ exclusion\ of\ original\ source))' \ - '-a-:architecture:(alpha amd64 arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc)' \ - '-v-:version:' \ + '-a-:architecture:_deb_architectures' \ + '-v-:version' \ '-C-:changes description:_files' \ '-m-:maintainer address:_email_addresses' \ '-e-:maintainer address:_email_addresses' \ diff --git a/Completion/Debian/Type/_deb_architectures b/Completion/Debian/Type/_deb_architectures new file mode 100644 index 000000000..22c43dd3e --- /dev/null +++ b/Completion/Debian/Type/_deb_architectures @@ -0,0 +1,9 @@ +#autoload + +local extra +zparseopts -E -D -a extra a: + +_description architectures expl 'architecture' +compadd "$@" "$expl[@]" alpha amd64 arm64 armel armhf hppa hurd-i386 i386 ia64 \ + kfreebsd-amd64 kfreebsd-i386 m68k mips mipsel powerpc powerpcspe ppc64 \ + ppc64el s390x sh4 sparc sparc64 x32 ${=extra[2]} diff --git a/Completion/Unix/Command/_runit b/Completion/Unix/Command/_runit new file mode 100644 index 000000000..81ba26a44 --- /dev/null +++ b/Completion/Unix/Command/_runit @@ -0,0 +1,73 @@ +#compdef sv + +_sv_commands() { + local -a sv_ary + sv_ary=( + 'status':'get status of service (and log service if available)' + 'up':'start if service is running. If service stops, restart' + 'down':'send SIGTERM and SIGCONT if service is running. After it stops, do not restart' + 'once':'start if service is not running. Do not restart if it stops' + 'pause':'send SIGSTOP if service is running' + 'cont':'send SIGCONT if service is running' + 'hup':'send SIGHUP if service is running' + 'alarm':'send SIGALRM if service is running' + 'interrupt':'send SIGINT if service is running' + 'quit':'send SIGQUIT if service is running' + '1':'send SIGUSR1 if service is running' + '2':'send SIGUSR2 if service is running' + 'term':'send SIGTERM if service is running' + 'kill':'send SIGKILL if service is running' + 'exit':'send SIGTERM and SIGCONT if service is running. Do not restart service.' + ) + _describe -t commands "sv commands" sv_ary -V sv_commands +} + +_sv_lsb() { + local -a sv_lsb_ary + sv_lsb_ary=( + 'start':'up with check/timeout' + 'stop':'down with check/timeout' + 'reload':'hup with check' + 'restart':'down and up with check' + 'shutdown':'exit with check/timeout' + 'force-stop':'stop with kill on timeout' + 'force-reload':'reload with kill on timeout' + 'force-restart':'restart with kill on timeout' + 'force-shutdown':'shutdown with kill on timeout' + 'try-restart':'restart if service is already running' + ) + + _describe -t lsb-commands "sv LSM init compat" sv_lsb_ary -V sv_init_compat +} + +_sv_additional() { + _describe -t additional-commands "sv additional commands" '("check:check status of service")' -V sv_addl_comm +} + +local curcontext="$curcontext" state line +_arguments -C \ + '-v[verbose]' \ + '-w[wait time]:time (seconds)' \ + '1: :->command' \ + '*:: :->options' + +case $state in + (command) + _alternative \ + _sv_commands \ + _sv_lsb \ + _sv_additional + ;; + + (options) + local -a sv_services + local svdir=${SVDIR:-/etc/service} + sv_services=( + $svdir/*(N) + $svdir/*/log(N) + ) + + sv_services=( ${sv_services#$svdir/} ) + _describe -t services "sv services" sv_services + ;; +esac diff --git a/Completion/Unix/Command/_xxd b/Completion/Unix/Command/_xxd new file mode 100644 index 000000000..1a822553c --- /dev/null +++ b/Completion/Unix/Command/_xxd @@ -0,0 +1,45 @@ +#compdef xxd + +local arguments + +# Output options compatibility matrix +# +# 0 - options conflict +# 1 - options coexist +# +# (The matrix is symmetric, so implied values are not shown.) +# +# bEipru +# bx10000 +# E-x0001 +# i--x001 +# p---x11 +# r----x0 +# u-----x + +# xxd supports either double or single dashes on long options. +[[ -prefix -- ]] && compset -P - + +arguments=( + # output options + '(-b -bits -i -include -p -postscript -plain -ps -r -reverse -u -uppercase)'{-b,-bits}'[output in binary digits, rather than hex]' + '( -E -EBCDIC -i -include -p -postscript -plain -ps -r -reverse )'{-E,-EBCDIC}'[print human-readable part in EBCDIC rather than ASCII]' + '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps -r -reverse )'{-i,-include}'[output in C include file style]' + '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps )'{-p,-postscript,-plain,-ps}'[read or write a plain hexdump (no line numbers or ASCII rendering)]' + + '(-b -bits -E -EBCDIC -i -include -r -reverse -u -uppercase)'{-r,-reverse}'[reverse mode\: read a hex dump and output binary data]' + '(-b -bits -r -reverse -u -uppercase)'{-u,-uppercase}'[output upper-case hex digits]' + + {-h,-help}'[display usage message]' + {-v,-version}'[show program version]' + '*'{-a,-autoskip}"[a single '*' replaces runs of NUL (toggleable)]" + + {-c+,-cols}'[specify number of octets per line]: :_guard "[0-9a-fA-Fx]#" "number of octets per line"' + {-g+,-groupsize}'[specify the number of octets per group]: :_guard "[0-9]#" "number of octets per group"' + {-l+,-len}'[specify number of octets to output]: :_guard "[0-9]#" "number of octets to output"' + {-s,-skip,-seek}'[specify file offset to dump from]: :_guard "[0-9]#" "file offset to dump from (absolute or relative)"' + + ':files:_files' +) + +_arguments -S $arguments diff --git a/Completion/X/Command/_xautolock b/Completion/X/Command/_xautolock new file mode 100644 index 000000000..4d01a1dd2 --- /dev/null +++ b/Completion/X/Command/_xautolock @@ -0,0 +1,25 @@ +#compdef xautolock +_arguments \ + '(-enable -toggle)-disable' \ + '(-disable -toggle)-enable' \ + '(-locknow)-unlocknow' \ + '(-unlocknow)-locknow' \ + '(-restart)-exit' \ + '(-exit)-restart' \ + '-killer:program: _command_names -e' \ + '-locker:program: _command_names -e' \ + '-notifier:program: _command_names -e' \ + '-nowlocker:program: _command_names -e' \ + -bell:percent: \ + -cornerdelay:seconds: \ + -cornerredelay:seconds: \ + -corners:corners: \ + -cornersize:pixels: \ + -killtime:minutes: \ + -noclose{,out,err} \ + -notify:seconds: \ + -time:minutes: \ + -secure \ + -resetsaver \ + -detectsleep \ + -{help,version} diff --git a/Completion/Zsh/Command/_zmodload b/Completion/Zsh/Command/_zmodload index ffcab28dd..e144b981e 100644 --- a/Completion/Zsh/Command/_zmodload +++ b/Completion/Zsh/Command/_zmodload @@ -4,35 +4,38 @@ local suf comp state line expl curcontext="$curcontext" ret=1 NORMARG typeset -A opt_args suf=() -_arguments -n -C -A "-*" -s \ - '(-i -u -d -a -b -c -I -p -f -e)-A[create module aliases]' \ - '-u[unload module]' \ - '(-e)-a[autoload module]' \ - '(-c -I -p -f)-b[autoload module for builtins]' \ - '(-b -I -p -f)-c[autoload module for condition codes]' \ - '(-i)-d[list or specify module dependencies]' \ - '(-i -u -d -a -b -c -p -f -L -A)-e[test if modules are loaded]' \ - '(-b -c -I -p)-f[autoload module for math functions]' \ - '(-u -b -c -p -f -A)-F[handle features]' \ +_arguments -n -C -S -s \ + '(-R -P -i -u -d -a -b -c -I -p -f -e -F -m)-A[create module aliases]' \ + '(-)-R[remove module aliases]' \ + '(-A -R -F -L -m -P -l -e)-u[unload module]' \ + '(-d -e -l)-a[autoload module]' \ + '(-c -d -I -p -f -F -P -l -m -A -R)-b[autoload module for builtins]' \ + '(-b -d -I -p -f -F -P -l -m -A -R)-c[autoload module for condition codes]' \ + '(-A -R -F -I -P -a -b -c -e -f -i -l -m -p)-d[list or specify module dependencies]' \ + '(-i -u -d -a -b -c -p -f -L -R)-e[test if modules are loaded]' \ + '(-b -c -d -I -p -F -P -l -m -A -R)-f[autoload module for math functions]' \ + '(-u -b -c -d -p -f -A -R -I)-F[handle features]' \ + '(-u -b -c -d -p -f -A -R -I)-m[treat feature arguments as patterns]' \ '(-d -e)-i[suppress error if command would do nothing]' \ - '(-b -c -p -f)-I[define infix condition names]' \ - '(-u -b -c -p -f -A)-l[list features]' \ + '(-b -c -d -p -f -F -P -m)-I[define infix condition names]' \ + '(-u -b -c -d -p -f -A -R)-l[list features]' \ '(-e -u)-L[output in the form of calls to zmodload]' \ - '(-b -c -I -f)-p[autoload module for parameters]' \ - '(-u -b -c -p -f -A)-P[array param for features]:array name:_parameters' \ - '*:params:->params' && ret=0 + '(-b -c -d -I -f -F -P -l -m -A -R)-p[autoload module for parameters]' \ + '(-u -b -c -d -p -f -A -R)-P[array param for features]:array name:_parameters' \ + '(-)*:params:->params' && ret=0 [[ $state = params ]] || return ret -(( $+opt_args[-A] )) && compset -P '*=' || suf=( -S '=' ) - +if (( $+opt_args[-A] )); then + compset -S '=*' || compset -P '*=' || suf=( -S '=' ) +fi if (( $+opt_args[-F] && CURRENT > NORMARG )); then local module=$words[NORMARG] local -a features if [[ $modules[$module] != loaded ]]; then - _message "features for unloaded module" + _message -e features "feature for unloaded module" else zmodload -lFP features $module if compset -P -; then @@ -41,6 +44,9 @@ if (( $+opt_args[-F] && CURRENT > NORMARG )); then elif compset -P +; then # only disabled features needed features=(${${features:#+*}##?}) + else + # complete opposite of current feature state, + is default + features=(${${features#-}/(#s)+/-}) fi _wanted features expl feature compadd -a features fi |