diff options
author | Oliver Kiddle <opk@zsh.org> | 2014-10-14 23:03:40 +0200 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2014-10-14 23:04:45 +0200 |
commit | 13fc579343b24d298fb8905933b6000d7fcda114 (patch) | |
tree | cbc1000696357438714107635f93166bcab76d3a /Completion/Unix | |
parent | 66320ca93a717467a0ed0d34da4c06257953aa50 (diff) | |
download | zsh-13fc579343b24d298fb8905933b6000d7fcda114.tar.gz zsh-13fc579343b24d298fb8905933b6000d7fcda114.tar.xz zsh-13fc579343b24d298fb8905933b6000d7fcda114.zip |
33467: correct return status on functions and numerous other minor fixes
Diffstat (limited to 'Completion/Unix')
36 files changed, 452 insertions, 559 deletions
diff --git a/Completion/Unix/Command/_arp b/Completion/Unix/Command/_arp index 64a8b8069..f340e979e 100644 --- a/Completion/Unix/Command/_arp +++ b/Completion/Unix/Command/_arp @@ -1,6 +1,6 @@ #compdef arp -local state line expl curcontext="$curcontext" +local state line expl curcontext="$curcontext" ret=1 local -a cmds cmds=(-a --display -d --delete -s --set -f --file) @@ -15,7 +15,9 @@ _arguments -C \ '(-H --hw-type -d --delete)'{-H,--hw-type}'[class of entries to check for]:class:(ether arcnet pronet ax25 netrom)' \ '(-n --numeric -d --delete -s --set -f --file)'{-n,--numeric}'[shows numerical addresses]' \ '(-v --verbose)'{-v,--verbose}'[be verbose]' \ - '(-a)1:host:->hostintable' + '(-a)1:host:->hostintable' && ret=0 [[ "$state" = hostintable ]] && - _wanted hosts expl 'host' compadd ${${${(f)"$(${words[1]} -an)"}##[ ?(]#}%%[ )]*} + _wanted hosts expl 'host' compadd ${${${(f)"$(${words[1]} -an)"}##[ ?(]#}%%[ )]*} && ret=0 + +return ret diff --git a/Completion/Unix/Command/_at b/Completion/Unix/Command/_at index 8734e6b55..b22589020 100644 --- a/Completion/Unix/Command/_at +++ b/Completion/Unix/Command/_at @@ -1,6 +1,6 @@ #compdef atrm atq at batch -local context state line expl +local context state line expl ret=1 typeset -A opt_args #todo (when extremely bored) make -l and -d do the atq and atrm completions @@ -8,12 +8,12 @@ case $service in atrm) _arguments \ '-V[print version number]' \ - '*:job number:->jobs' + '*:job number:->jobs' && ret=0 ;; atq) _arguments \ '-V[print version number]' \ - '-q[uses specified queue]:a-z+A-Z' + '-q[uses specified queue]:a-z+A-Z' && ret=0 ;; at|batch) _arguments \ @@ -29,11 +29,13 @@ at|batch) - atrm \ '-d[alias for atrm]' \ - show-job \ - '-c[cat specified jobs to stdout]:*:job number:->jobs' + '-c[cat specified jobs to stdout]:*:job number:->jobs' && ret=0 esac case $state in jobs) - _wanted job expl 'job number' compadd ${(M)${(f)"$(_call_program job atq)"}##<->} + _wanted -C $context jobs expl 'job number' compadd ${(M)${(f)"$(_call_program job atq)"}##<->} && ret=0 ;; esac + +return ret diff --git a/Completion/Unix/Command/_bittorrent b/Completion/Unix/Command/_bittorrent index f7da2047a..1f305a1c0 100644 --- a/Completion/Unix/Command/_bittorrent +++ b/Completion/Unix/Command/_bittorrent @@ -21,7 +21,7 @@ case $service in ;& btlaunchmanycurses) _arguments -s -S \ - '(--responsefile)--responsefile+[specify file for server response]:file:_files -g "*"'\ + '(--responsefile)--responsefile+[specify file for server response]:file:_files'\ "--url+[specify URL of torrent file]:URL:_urls"\ '(-i --ip)'{-i+,--ip+}'[specify ip address to report as]:ip address'\ "--bind+[specify ip to bind to instead of default]:ip:_bind_addresses"\ @@ -50,18 +50,18 @@ case $service in "--max_initiate+[specify peers needed before stopping initiating new connections]:peers:"\ "--report_hash_failures+[report hash failures to user]:enable:(0 1)"\ "--rarest_first_priority_cutoff+[specify peers which need to have a piece before other partials take priority over rarest first]:peers:"\ - ':torrent file:_files -g "*.torrent(-.)"' \ - && return 0 + ':torrent file:_files -g "*.torrent(-.)"' + return ;; # Next up are the torrent file manipulation programs. btshowmetainfo) - _files -g "*.torrent(-.)" && return 0 - ;; + _files -g "*.torrent(-.)" && return + ;; btrename) - _files -g '*.torrent(-.)' && return 0 + _files -g '*.torrent(-.)' && return ;; btmakemetafile) @@ -69,12 +69,12 @@ case $service in '--piece_size_pow2+[specify power of 2 to set the piece size to]:power:' \ "--comment+[specify human-readable comment to put in .torrent]:comment:"\ "--target+[specify target file for the torrent]:file:_files"\ - ':file:_files -g "*"' \ - && return 0; + ':file:_files -g "*"' + return ;; btreannounce) - _files -g '*.torrent(-.)' && return 0 + _files -g '*.torrent(-.)' && return ;; # Lastly the tracker. @@ -94,7 +94,7 @@ case $service in "--min_time_between_log_flushes+[specify minimum time between log flushes]:time (s):" \ "--allowed_dir+[specify directory having downloadable torrents]:directory:_files -/" \ "--parse_allowed_interval+[specify interval between reloading allowed_dir]:time (min):" \ - "--show_names+[display names from allowed dir]:enable:(0 1)"\ - && return 0 - ;; + "--show_names+[display names from allowed dir]:enable:(0 1)" + return + ;; esac diff --git a/Completion/Unix/Command/_bogofilter b/Completion/Unix/Command/_bogofilter index 44953cc71..ff36e83af 100644 --- a/Completion/Unix/Command/_bogofilter +++ b/Completion/Unix/Command/_bogofilter @@ -1,7 +1,5 @@ #compdef bogoutil bogotune bogofilter -local expl ret bogotokens - _bogoutil_caching_policy () { local -a oldp @@ -14,6 +12,7 @@ _bogoutil_caching_policy () { _bogoutil() { + local bogotokens expl ret=1 typeset -a _bogoutil_actions _bogoutil_actions=(-h --help -V --version -d --dump -l --load -u --upgrade -m -w -p -H --db-verify -r -R --db-prune --db-recover @@ -46,30 +45,27 @@ _bogoutil() { "($_bogoutil_actions)"'--db-remove-environment:database:_files -/' \ '--db_lk_max_locks[set max lock count]' \ '--db_lk_max_objects[set max object count]' \ - "($_bogoutil_actions)"'-h[help]' \ - "($_bogoutil_actions)"'--help' \ - "($_bogoutil_actions)"'-V[version]' \ - "($_bogoutil_actions)"'--version' \ + "($_bogoutil_actions)"{-h,--help}'[help]' \ + "($_bogoutil_actions)"{-V,--version}'[version]' \ '*:tokens:->tokens' && ret=0 zstyle -s ":completion:${curcontext}:" cache-policy update_policy if [[ -z "$update_policy" ]]; then zstyle ":completion:${curcontext}:" cache-policy _bogoutil_caching_policy fi - + case $state in (tokens) if ( [[ -z "$bogotokens" ]] || _cache_invalid bogotokens ) && ! _retrieve_cache bogotokens; then - bogotokens=(${${(f)"$(_call_program bogoutil bogoutil -d ~/.bogofilter/wordlist.db -c 50)"}%% *}) + bogotokens=(${${(f)"$(_call_program bogotokens bogoutil -d ~/.bogofilter/wordlist.db -c 50)"}%% *}) _store_cache bogotokens bogotokens - else - : fi - _wanted tokens expl "token" \ - compadd -a bogotokens + _wanted tokens expl "token" compadd -a bogotokens && ret=0 ;; esac + + return ret } case $service in diff --git a/Completion/Unix/Command/_bpython b/Completion/Unix/Command/_bpython index c51cc8c3c..233e032e6 100644 --- a/Completion/Unix/Command/_bpython +++ b/Completion/Unix/Command/_bpython @@ -13,10 +13,10 @@ all_opts=( ) urwid_opts=( - '(-r --reactor)'{-r,--reactor}'[use Twisted reactor instead of the event loop]:reactor:' + '(-r --reactor)'{-r,--reactor}'[use twisted reactor instead of the event loop]:reactor' '--help-reactors[display list of available Twisted reactors]' - '(-p --plugin)'{-p,--plugin}'[exectue a twistd plugin]:plugin:' - '(-s --server)'{-s,--server}'[run an eval server on the given port]:port:' + '(-p --plugin)'{-p,--plugin}'[execute a twisted plugin]:plugin' + '(-s --server)'{-s,--server}'[run an eval server on the given port]:port:_ports' ) gtk_opts=( @@ -26,19 +26,19 @@ gtk_opts=( case "$service" in bpython|bpython2|bpython3) _arguments \ - "$all_opts[@]" && return 0 + "$all_opts[@]" ;; bpython-urwid|bpython2-urwid|bpython3-urwid) _arguments \ "$all_opts[@]" \ - "$urwid_opts[@]" && return 0 + "$urwid_opts[@]" ;; bpython-gtk|bpython2-gtk|bpython3-gtk) _arguments \ "$all_opts[@]" \ - "$gtk_opts[@]" && return 0 + "$gtk_opts[@]" ;; esac diff --git a/Completion/Unix/Command/_bzr b/Completion/Unix/Command/_bzr index c28c2148e..4a4e5ab83 100644 --- a/Completion/Unix/Command/_bzr +++ b/Completion/Unix/Command/_bzr @@ -11,12 +11,12 @@ _arguments -C \ if (( ! $+_bzr_cmds )); then typeset -gH _bzr_cmds - _bzr_cmds=(${(f)"$(_call_program bzr bzr shell-complete)"}) + _bzr_cmds=(${(f)"$(_call_program subcommands bzr shell-complete)"}) fi if [[ $state != 'args' ]]; then - _describe -t subcommand 'subcommand' _bzr_cmds - return 0 + _describe -t subcommands 'subcommand' _bzr_cmds + return fi cmd="$words[1]" @@ -25,39 +25,35 @@ curcontext="${curcontext%:*:*}:bzr-$cmd:" (( $+functions[_bzr_unknownFiles] )) || _bzr_unknownFiles() { local fileList - fileList=(${(ps:\0:)"$(bzr ls --null --unknown -R)"}) + fileList=(${(ps:\0:)"$(_call_program files bzr ls --null --unknown -R)"}) compadd -af fileList - return 0 } (( $+functions[_bzr_unknownRoot] )) || _bzr_unknownRoot() { - local fileList - fileList=(${(ps:\0:)"$(bzr ls --null --from-root --unknown)"}) + local -a fileList + fileList=(${(ps:\0:)"$(_call_program files bzr ls --null --from-root --unknown)"}) compadd -af fileList - return 0 } (( $+functions[_bzr_versionedFiles] )) || _bzr_versionedFiles() { local fileList - fileList=(${(ps:\0:)"$(bzr ls --null --versioned -R)"}) + fileList=(${(ps:\0:)"$(_call_program files bzr ls --null --versioned -R)"}) compadd -af fileList - return 0 } (( $+functions[_bzr_modifiedFiles] )) || _bzr_modifiedFiles() { local fileList - fileList=(${(ps:\0:)"$(bzr status . --versioned --short | cut -b 5- | tr '\n' '\0')"}) + fileList=(${(ps:\0:)"$(_call_program files bzr status . --versioned --short | cut -b 5- | tr '\n' '\0')"}) compadd -af fileList - return 0 } (( $+functions[_bzr_completeParents] )) || _bzr_completeParents() { - local parentFile=$(bzr root 2>/dev/null)/.bzr/branch/parent - [[ -r $parentFile ]] && compadd -X "Completing parents" $(cat $parentFile) + local parentFile=$(_call_program parents bzr root)/.bzr/branch/parent + [[ -r $parentFile ]] && _wanted parents expl parent compadd -- $(<$parentFile) } args=( '(-)'{--help,-h}'[show help message]' ) @@ -99,7 +95,7 @@ case $cmd in '--lightweight[perform a lightweight checkout]' '(-r --revision)'{--revision=,-r}'[the revision to get]:rev:' ) - _bzr_completeParents + _bzr_completeParents && ret=0 ;; (rename|move|mv) @@ -194,7 +190,7 @@ case $cmd in '(-v --verbose)'{--verbose,-v}'[display more information]' '*:local repository:_files -/' ) - _bzr_completeParents + _bzr_completeParents && ret=0 ;; (missing) @@ -210,7 +206,7 @@ case $cmd in '(-v --verbose)'{--verbose,-v}'[display more information]' '*:local repository:_files -/' ) - _bzr_completeParents + _bzr_completeParents && ret=0 ;; (commit|checkin|ci) @@ -227,7 +223,7 @@ case $cmd in ;; (bind|break-lock|reconcile) - _bzr_completeParents + _bzr_completeParents && ret=0 ;; (register-branch) @@ -240,7 +236,7 @@ case $cmd in '--link-bug=[the bug this branch fixes]:bug-ID:' '--product=[launchpad product short name to associate with the branch]:product:' ) - _bzr_completeParents + _bzr_completeParents && ret=0 ;; (remerge) @@ -249,7 +245,7 @@ case $cmd in '--reprocess[reprocess to reduce spurious conflicts]' '--show-base[show base revision text in conflicts]' ) - _bzr_completeParents + _bzr_completeParents && ret=0 ;; (conflicts|added|deleted|modified|unknowns|directories|ignored|unbind|nick|revno|version) @@ -322,7 +318,7 @@ case $cmd in '--show-base[show base revision text in conflicts]' '*:local repository:_files -/' ) - _bzr_completeParents + _bzr_completeParents && ret=0 ;; (ls) @@ -346,7 +342,7 @@ case $cmd in '(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]' '*:local repository:_files -/' ) - _bzr_completeParents + _bzr_completeParents && ret=0 ;; (help) @@ -355,8 +351,8 @@ case $cmd in '*:subcmds:->cmds' ) _arguments -s "$args[@]" && ret=0 - _describe -t subcommand 'subcommand' _bzr_cmds - return 0 + _describe -t subcommands 'subcommand' _bzr_cmds && ret=0 + return ret ;; # Plugins @@ -380,7 +376,7 @@ case $cmd in '--remember[remember the specified location as a default]' '*:local repository:_files -/' ) - _bzr_completeParents + _bzr_completeParents && ret=0 ;; (clean-tree) @@ -409,10 +405,11 @@ case $cmd in ;; (*) - _message "unknown bzr command completion: $cmd" - return 1 + _default + return ;; esac _arguments -s "$args[@]" && ret=0 -return $ret + +return ret diff --git a/Completion/Unix/Command/_cdrdao b/Completion/Unix/Command/_cdrdao index 06b47c9b1..ad1bf4034 100644 --- a/Completion/Unix/Command/_cdrdao +++ b/Completion/Unix/Command/_cdrdao @@ -4,108 +4,85 @@ # Command completion and main loop {{{1 -_cdrdao_commands () { - local -a commands - - commands=( - 'show-toc:print out a summary of a TOC' - 'read-toc:create a TOC file based on a CD' - 'read-cd:create a TOC file and image file based on a CD' - 'read-cddb:add CD-TEXT data from a CDDB server to a TOC' - 'show-data:print out samples that would be written to CD' - 'read-test:check if data described in a TOC can be read from a CD' - 'disk-info:show information about a CD' - 'msinfo:generate mkisofs command for creating multi-session CD' - 'unlock:try to unlock a recorder after a failed run' - 'blank:blank a CD-RW' - 'simulate:simulate a write' - 'write:write a CD based on a TOC' - 'copy:copy a CD' - ) - - _describe -t commands 'cdrdao command' commands && ret=0 -} - _cdrdao () { - local curcontext=$curcontext ret=1 - - local context state line - typeset -A opt_args - _arguments \ - ':command:->command' \ - '*::options:->options' && ret=0 - case $state in - (command) - _cdrdao_commands - ;; - (options) - curcontext="${curcontext%:*:*}:cdrdao-$words[1]:" - _call_function ret _cdrdao-$words[1] - ;; - esac + local ret=1 + local -a commands + if (( CURRENT == 2 )); then + commands=( ${${${(M)${(f)"$(_call_program subcommands cdrdao 2>&1)"}:# *}// #- /:}#??} ) + _describe -t subcommands 'cdrdao command' commands && ret=0 + else + local cmd="${words[2]}" + local curcontext="${curcontext%:*:*}:cdrdao-$cmd:" + shift words + (( CURRENT-- )) + if ! _call_function ret _cdrdao-$cmd; then + _default && ret=0 + fi + fi + return ret } # Common arguments {{{1 -declare -ga tmpfile_args -tmpfile_args=( +declare -ga _cdrdao_tmpfile_args +_cdrdao_tmpfile_args=( '--tmpdir[directory to store temporary data in]:directory:_directories' - '--keep[do not remove temporary data when done]') - -declare -ga device_args -device_args=( - '--device[set SCSI address of the CD recorder]:device:__cdrdao-device' - '--driver[use given driver for the CD recorder]:driver:__cdrdao-drivers') + '--keep[do not remove temporary data when done]' +) # TODO: Gah! Fix a cddb server spec matcher -declare -ga cddb_args -cddb_args=( +declare -ga _cdrdao_cddb_args +_cdrdao_cddb_args=( '--cddb-servers[specify list of CDDB servers to use]:CDDB servers:' '--cddb-timeout[specify timeout in seconds for connections to CDDB servers]: :_guard "[[\:digit\:]]" timeout' - '--cddb-directory[directory where fetched CDDB records will be stored]:directory:_directories') + '--cddb-directory[directory where fetched CDDB records will be stored]:directory:_directories' +) -declare -g paranoiamode_arg= -paranoiamode_arg='--paranoia-mode[set correction mode for digital audio extraction]:mode:(("0\:no checking" "1\:perform overlapped reading to avoid jitter" "2\:like 1 but with checks of read audio data" "3\:like 2 but with scratch detection/repair (default)"))' +declare -g _cdrdao_paranoiamode_arg +_cdrdao_paranoiamode_arg='--paranoia-mode[set correction mode for digital audio extraction]:mode:(("0\:no checking" "1\:perform overlapped reading to avoid jitter" "2\:like 1 but with checks of read audio data" "3\:like 2 but with scratch detection/repair (default)"))' -declare -g fasttoc_arg= -fasttoc_arg='--fast-toc[skip pre-gap-length and index-mark extraction]' +declare -g _cdrdao_fasttoc_arg +_cdrdao_fasttoc_arg='--fast-toc[skip pre-gap-length and index-mark extraction]' -declare -g swap_arg= -swap_arg='--swap[swap the byte order of samples]' +declare -g _cdrdao_swap_arg +_cdrdao_swap_arg='--swap[swap the byte order of samples]' -declare -g reload_arg= -reload_arg='--reload[reload the disk if necessary]' +declare -g _cdrdao_reload_arg +_cdrdao_reload_arg='--reload[reload the disk if necessary]' -declare -g eject_arg= -eject_arg='--eject[eject CD after completed operation]' +declare -g _cdrdao_eject_arg +_cdrdao_eject_arg='--eject[eject CD after completed operation]' -declare -g speed_arg= -speed_arg='-speed[set writing speed]: :_guard "[[\:digit\:]]##" speed' +declare -g _cdrdao_speed_arg +_cdrdao_speed_arg='-speed[set writing speed]: :_guard "[[\:digit\:]]##" speed' -declare -ga common_args -common_args=( +declare -ga _cdrdao_common_args +_cdrdao_common_args=( '(*)'{-h,--help}'[display command/option summary]' '-v[set verbosity level]: :_guard "[[\:digit\:]]##" verbosity') -declare -ga common_toc_args -common_toc_args=( - $common_args +declare -ga _cdrdao_common_toc_args +_cdrdao_common_toc_args=( + $_cdrdao_common_args ':TOC file:_files -g "*.toc(-.)"') -declare -ga common_device_args -common_device_args=( - $common_args - $device_args) - -declare -ga common_toc_device_args -common_toc_device_args=( - $common_toc_args - $common_device_args - $force_arg) - -declare -ga common_read_args -common_read_args=( +declare -ga _cdrdao_common_device_args +_cdrdao_common_device_args=( + $_cdrdao_common_args + '--device[set SCSI address of the CD recorder]:device:__cdrdao-device' + '--driver[use given driver for the CD recorder]:driver:__cdrdao-drivers' +) + +declare -ga _cdrdao_common_toc_device_args +_cdrdao_common_toc_device_args=( + $_cdrdao_common_toc_args + $_cdrdao_common_device_args + '--force[force execution of operation]' +) + +declare -ga _cdrdao_common_read_args +_cdrdao_common_read_args=( '--rspeed[set reading speed]: :_guard "[[\:digit\:]]##" speed' '--session[specify what session to process on multi-session CDs]: :_guard "[[\:digit\:]]##" "session number"' '--read-subchan[set sub-channel reading-mode]:mode:(("rw\:de-interleaved and error corrected" "rw_raw\:not de-interleaved, not error-corrected, and L-EC data included"))' @@ -128,18 +105,18 @@ _cdrdao-toc-size () { __cdrdao-show-toc-or-toc-info-or-toc-size () { _arguments \ - $common_toc_args \ - $tmpfile_args && ret=0 + $_cdrdao_common_toc_args \ + $_cdrdao_tmpfile_args } _cdrdao-read-toc () { - __cdrdao-read-toc-or-read-cd \ - $fasttoc_arg + __cdrdao-read-toc-or-read-cd $_cdrdao_cddb_args } _cdrdao-read-cd () { __cdrdao-read-toc-or-read-cd \ - $paranoiamode_arg + $_cdrdao_paranoiamode_arg \ + $_cdrdao_cddb_args } __cdrdao-read-toc-or-read-cd () { @@ -148,30 +125,31 @@ __cdrdao-read-toc-or-read-cd () { __cdrdao-read-toc-or-read-cd-or-copy-dependent-args _arguments \ - $common_toc_device_args \ - $common_read_args \ - $dependent_args + $_cdrdao_common_toc_device_args \ + $_cdrdao_common_read_args \ + $dependent_args \ + $_cdrdao_fasttoc_arg \ '--datafile[set name of data file placed in TOC file]:file:_files' \ '--read-raw[read data in raw format from CD]' \ '--no-mode2-mixed[if MODE2_FORM1 or MODE2_FORM2, do not extract as MODE2_FORM_MIX]' \ - $* && ret=0 + "$@" && ret=0 } _cdrdao-read-cddb () { _arguments \ - $common_toc_args \ - $cddb_args && ret=0 + $_cdrdao_common_toc_args \ + $_cdrdao_cddb_args } _cdrdao-show-data () { _arguments \ - $common_toc_args \ - $swap_arg && ret=0 + $_cdrdao_common_toc_args \ + $_cdrdao_swap_arg } _cdrdao-read-test () { _arguments \ - $common_toc_args && ret=0 + $_cdrdao_common_toc_args } _cdrdao-disk-info () { @@ -180,13 +158,18 @@ _cdrdao-disk-info () { __cdrdao-disk-info-or-drive-info () { _arguments \ - $common_device_args && ret=0 + $_cdrdao_common_device_args +} + +_cdrdao-discid() { + _arguments $_cdrdao_common_device_args $_cdrdao_cddb_args \ + '--query-string[print out CDDB query only]' } _cdrdao-msinfo () { _arguments \ - $common_device_args \ - $reload_arg && ret=0 + $_cdrdao_common_device_args \ + $_cdrdao_reload_arg } _cdrdao-drive-info () { @@ -195,22 +178,22 @@ _cdrdao-drive-info () { _cdrdao-unlock () { _arguments \ - $common_device_args \ - $reload_arg \ - $eject_arg && ret=0 + $_cdrdao_common_device_args \ + $_cdrdao_reload_arg \ + $_cdrdao_eject_arg } _cdrdao-blank () { _arguments \ - $common_device_args \ - $speed_arg \ + $_cdrdao_common_device_args \ + $_cdrdao_speed_arg \ '--blank-mode[set the blanking mode]:blanking mode:(("full\:completely erase data" "minimal\:only dereference data"))' \ - $eject_arg && ret=0 + $_cdrdao_eject_arg } _cdrdao-scanbus () { _arguments \ - $common_args && ret=0 + $_cdrdao_common_args } _cdrdao-simulate () { @@ -218,26 +201,26 @@ _cdrdao-simulate () { } __cdrdao-simulate-or-write () { - local capacity_arg= - + local _cdrdao_capacity_arg= + if (( $words[(I)--full-burn] )); then - capacity_arg='--capacity[set disk capacity for --full-burn]: :_guard "[[\:digit\:]]" minutes' + _cdrdao_capacity_arg='--capacity[set disk capacity for --full-burn]: :_guard "[[\:digit\:]]" minutes' fi _arguments \ - $common_toc_device_args \ - $speed_arg \ + $_cdrdao_common_toc_device_args \ + $_cdrdao_speed_arg \ '--multi[do not close the session after successful write]' \ '--overburn[allow overburing of medium]' \ '--full-burn[force burning to the outer disk edge]' \ - $capacity_arg \ - $eject_arg \ - $swap_arg \ + $_cdrdao_capacity_arg \ + $_cdrdao_eject_arg \ + $_cdrdao_swap_arg \ '--buffers[set fifo buffer size]: :_guard "[[\:digit\:]]" size' \ - $reload_arg \ - $tmpfile_args \ + $_cdrdao_reload_arg \ + $_cdrdao_tmpfile_args \ '-n[do not pause before writing]' \ - $* && ret=0 + $* } _cdrdao-write () { @@ -254,24 +237,24 @@ __cdrdao-read-toc-or-read-cd-or-copy-dependent-args () { fi if (( words[(I)--with-cddb] )); then - dependent_args+=$cddb_args + dependent_args+=$_cdrdao_cddb_args fi } _cdrdao-copy () { - local -ga dependent_args + local -a dependent_args __cdrdao-read-toc-or-read-cd-or-copy-dependent-args _cdrdao-write \ - $dependent_args - $common_read_args + $dependent_args \ + $_cdrdao_common_read_args \ '--source-device[set SCSI address of the CD reader]:device:__cdrdao-device' \ '--source-driver[use given driver for the CD reader]:driver:__cdrdao-drivers' \ '--on-the-fly[perform on-the-fly copy of CD (no image created)]' \ - $fasttoc_arg \ + $_cdrdao_fasttoc_arg \ '--keepimage[do not remove generated image when done]' \ - $paranoiamode_arg && ret=0 + $_cdrdao_paranoiamode_arg } # Type completion {{{1 @@ -280,24 +263,21 @@ __cdrdao-device () { # Use cdrdao scanbus and also check what OS we're running under and provide # additional stuff, like devices (/dev/sg0) local -a devices + devices=(${${(f)"$(_call_program devices cdrdao scanbus -v 0 2>&1)"}%% :*}) - devices=(${(f)"$(_call_program devices cdrdao scanbus -v 0 2>/dev/null)"}) - if (( ${#pipestatus:#0} > 0 )); then - return 1 - fi - - _wanted devices expl 'device' compadd - $devices + _wanted devices expl 'device' compadd -a devices } __cdrdao-drivers () { - local -a drivers - - drivers=(${(f)"$(_call_program drivers cut -d'|' -f4 /usr/share/cdrdao/drivers -s 2>/dev/null | sort -u)"}) - if (( ${#pipestatus:#0} > 0 )); then - return 1 + local suf + local -Ua drivers + drivers=(${(f)"$(_call_program drivers cut -d'\|' -f4 /usr/share/cdrdao/drivers -s)"}) + if compset -P \*:; then + _message -e options option + else + compset -S :\* || suf=-qS: + _wanted drivers expl 'driver' compadd $suf -a drivers fi - - _wanted drivers expl 'driver' compadd -qS: - $drivers } # }}}1 diff --git a/Completion/Unix/Command/_chmod b/Completion/Unix/Command/_chmod index 5d3cb2c78..48ce050e4 100644 --- a/Completion/Unix/Command/_chmod +++ b/Completion/Unix/Command/_chmod @@ -49,7 +49,7 @@ case "$state" in compset -P '*' _alternative -O suf \ 'who:who:((u\:user g\:group a\:all o\:others))' \ - 'operators:operator:(+ - =)' + 'operators:operator:(+ - =)' && ret=0 fi ;; files) diff --git a/Completion/Unix/Command/_cpio b/Completion/Unix/Command/_cpio index 280a8930f..6b07a214a 100644 --- a/Completion/Unix/Command/_cpio +++ b/Completion/Unix/Command/_cpio @@ -1,17 +1,17 @@ #compdef cpio local args ig curcontext="$curcontext" state line -local expl ret +local expl ret=1 local fmts='(bar bin odc newc crc tar ustar hpbin hpodc)' _pick_variant -r ig gnu=GNU unix --version if (( CURRENT == 2 )); then - # Complete arguments + # Complete arguments args=('-o[create archive]' '-i[extract from archive]' '-p[run as filter on directory tree]') [[ $ig = gnu ]] && args=($args '--create[create archive]' - '--extract[extract from archive]' + '--extract[extract from archive]' '--pass-through[run as filter on directory tree]' '--help[show help text]' '--version[show version information]') else @@ -23,13 +23,13 @@ else "--format=:format type:$fmts" '--message=:message at end of volume:' '--null' '--reset-access-time' - '--verbose' '--dot' '--append' + '--verbose' '--dot' '--append' '--block-size=:block size in 512 byte units:' '--dereference' '--io-size=:block size in bytes' '--quiet' '--force-local' '--help' '--version') fi - args=($args + args+=( '-A[append files to archive]' '-B[block size 5120 bytes with special file]' '-C[set block size per record]:block size in bytes:(8192)' @@ -44,10 +44,10 @@ else if [[ $ig = gnu ]]; then args=('--file=:archive file:->afile' "--format=:format type:$fmts" - '--make-directories' '--nonmatching' + '--make-directories' '--nonmatching' '--preserve-modification-time' '--numeric' '--rename' '--list' '--swap-bytes' '--swap-halfwords' - '--dot' '--unconditional' '--verbose' + '--dot' '--unconditional' '--verbose' '--block-size=:block size in 512 byte units:' '--swap-halfwords' '--io-size=:block size in bytes:' @@ -58,7 +58,7 @@ else '--no-absolute-filenames' '--sparse' '--only-verify-crc' '--quiet' '--help' '--version') fi - args=($args + args+=( '-b[reverse bytes in word]' '-B[block size 5120 bytes with special file]' '-d[create directories as needed]' @@ -87,7 +87,7 @@ else '--owner=:user (and group) for files:->user' '--no-preserve-owner' '--sparse' '--help' '--version') fi - args=($args + args+=( '-d[create directories as needed]' '-l[link files instead of copying]' '-L[follow symbolic links]' @@ -98,12 +98,11 @@ else else return 1 fi - args=($args + args+=( '-a[reset access time of input files]' ) -fi +fi -ret=1 _arguments -C -s "$args[@]" && ret=0 if [[ $state = afile ]]; then @@ -121,12 +120,12 @@ if [[ $state = afile ]]; then fi elif [[ $state = user ]]; then if compset -P '*[:.]'; then - _groups + _groups && ret=0 else local suf=. [[ $OSTYPE = (solaris|hpux)* ]] && suf=: compset -S '.*' && unset suf - _users -S "$suf" -q + _users -S "$suf" -q && ret=0 fi fi diff --git a/Completion/Unix/Command/_df b/Completion/Unix/Command/_df index 892f91fa0..a98180a2c 100644 --- a/Completion/Unix/Command/_df +++ b/Completion/Unix/Command/_df @@ -1,6 +1,6 @@ #compdef df -local context state state_descr line args spec +local curcontext="$curcontext" state state_descr line args spec ret=1 local -A opt_args if _pick_variant gnu=GNU unix --version; then @@ -34,6 +34,7 @@ elif [[ "$OSTYPE" == (darwin|freebsd|dragonfly)* ]]; then '(-b -g -H -h -k -m)-m[use 1024*1024-byte blocks]' '-P[POSIX compliant output]' '-a[show all mount points]' + '-c[display a grand total]' '-i[include inode usage statistics (default)]' '-l[only display locally-mounted file systems]' '-n[use previously obtained statistics]' @@ -44,7 +45,7 @@ elif [[ "$OSTYPE" == (darwin|freebsd|dragonfly)* ]]; then (darwin*) args+=( "-T+$spec" -# '-t[same as -T (obsolete)]:file system type:->fslist' + "!-t+$spec" # obsolete ) ;; (freebsd*|dragonfly*) @@ -61,19 +62,15 @@ else ) fi -_arguments -s -S : $args && return 0 +_arguments -C -s -S : $args && ret=0 case "$state" in (fslist) - local -a fsys used pre disp expl - _file_systems -U -O fsys - pre=$IPREFIX - # offer 'no' only if at the beginning of the list - if ! compset -P '*,' && ! compset -P 'no'; then - disp=( 'no -- exclude file system types in the list' ) - _wanted list-prefix expl 'prefix to list' compadd -d disp 'no' - fi - used=( ${(s:,:)${${IPREFIX#$pre}#no}} ) - _wanted fsys-types expl "$state_descr" compadd -qS , -F used -a fsys + [[ ! -prefix *, ]] && ! compset -P 'no' && + _describe -t list-prefixes 'prefix to list' \ + '( no:exclude\ file\ system\ types\ in\ the\ list )' && ret=0 + _sequence -s , _file_systems && ret=0 ;; esac + +return ret diff --git a/Completion/Unix/Command/_django b/Completion/Unix/Command/_django index ac20409eb..029687696 100644 --- a/Completion/Unix/Command/_django +++ b/Completion/Unix/Command/_django @@ -1,26 +1,23 @@ #compdef django-admin.py django-admin manage.py -local ret=1 state +local curcontext="$curcontext" state line expl ret=1 -if [ "$service" = "manage.py" ] && [ ! -x ./manage.py ]; then - return 0 +if [[ "$service" = "manage.py" && ! -x ./manage.py ]]; then + _default + return fi declare -ga common_args common_args=( '--help[display help information]' '--version[display version information]' - '--pythonpath=[directory to add to the Python path]:directory:_directories' - '--settings=[Python path to settings module]:settings' + '--pythonpath=[directory to add to the Python path]:directory:_directories -W / -P /' + '--settings=[python path to settings module]:settings' '--traceback[print traceback on exception]' ) -_directories () { - _wanted directories expl directory _path_files -/ "$@" - -} - typeset -A opt_args -_arguments \ +_arguments -C \ $common_args \ ':subcommand:->subcommand' \ '*::options:->options' && ret=0 @@ -66,7 +63,7 @@ case $state in subcommands+=($cmd) fi done - + _describe -t subcommands 'django admin subcommand' subcommands && ret=0 ;; @@ -101,8 +98,8 @@ case $state in settings="${DJANGO_SETTINGS_MODULE}" else return 0 - fi - + fi + _wanted appname expl appname compadd - $(command \ sed -n "/INSTALLED_APPS\s*=\s*(/,/)/p" ${settings} | \ sed -n "s/^\s*'\(.*\.\)*\(.*\)'.*$/\2 /pg") @@ -205,7 +202,7 @@ case $state in ;; esac - _arguments $args && ret=0 + _arguments -C $args && ret=0 ;; esac diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index c4e386b15..38bd72979 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5262,12 +5262,10 @@ __git_gpg_secret_keys () { (( $+functions[__git_merge_strategies] )) || __git_merge_strategies () { local expl - local -a merge_strategies - merge_strategies=(${=${${(M)${(f)"$(_call_program merge-strategies "git merge -s '' 2>&1")"}:#[Aa]vailable (custom )#strategies are: *}#[Aa]vailable (custom )#strategies are: }%.}) - __git_command_successful $pipestatus || return 1 - - _wanted merge-strategies expl 'merge strategy' compadd $* - $merge_strategies + _wanted merge-strategies expl 'merge strategy' compadd "$@" - \ + ${=${${${(M)${(f)"$(_call_program merge-strategies \ + "git merge -s '' 2>&1")"}:#[Aa]vailable (custom )#strategies are: *}#[Aa]vailable (custom )#strategies are: }%.}:-octopus ours recursive resolve subtree} } (( $+functions[__git_encodings] )) || @@ -5299,8 +5297,9 @@ __git_remotes () { local remotes expl remotes=(${(f)"$(_call_program remotes git remote 2>/dev/null)"}) + __git_command_successful $pipestatus || return 1 - _wanted remotes expl remote compadd $* - $remotes + _wanted remotes expl remote compadd "$@" -a - remotes } (( $+functions[__git_ref_specs] )) || @@ -5431,13 +5430,7 @@ __git_reflog_entries () { reflog_entries=(${${${(f)"$(_call_program reflog-entries git reflog 2>/dev/null)"}#* }%%:*}) __git_command_successful $pipestatus || return 1 - if compset -P '*@'; then - reflog_entries=(${${(M)reflog_entries:#$IPREFIX*}#$IPREFIX}) - _wanted reflog-entries expl 'reflog entry' compadd $* - $reflog_entries - else - reflog_entries=(${reflog_entries%@*}) - _wanted reflog-entries expl 'reflog entry' compadd -qS @ $* - $reflog_entries - fi + _wanted reflog-entries expl 'reflog entry' _multi_parts @ reflog_entries } (( $+functions[__git_ref_sort_keys] )) || @@ -5492,7 +5485,7 @@ __git_stashes () { stashes=(${${(f)"$(_call_program stashes git stash list 2>/dev/null)"}/: */}) __git_command_successful $pipestatus || return 1 - _wanted stashes expl stash compadd $* - $stashes + _wanted stashes expl stash compadd "$@" -a - stashes } (( $+functions[__git_svn_revisions] )) || @@ -5531,7 +5524,7 @@ __git_branch_names () { branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) __git_command_successful $pipestatus || return 1 - _wanted branch-names expl branch-name compadd $* - $branch_names + _wanted branch-names expl branch-name compadd "$@" -a - branch_names } (( $+functions[__git_remote_branch_names] )) || @@ -5542,7 +5535,7 @@ __git_remote_branch_names () { branch_names=(${${(f)"$(_call_program remote-branch-refs git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/}) __git_command_successful $pipestatus || return 1 - _wanted remote-branch-names expl 'remote branch name' compadd $* - $branch_names + _wanted remote-branch-names expl 'remote branch name' compadd "$@" -a - branch_names } (( $+functions[__git_remote_branch_names_noprefix] )) || @@ -5553,7 +5546,7 @@ __git_remote_branch_names_noprefix () { branch_names=(${${${(f)"$(_call_program remote-branch-refs-noprefix git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}##*/}:#HEAD}) __git_command_successful $pipestatus || return 1 - _wanted remote-branch-names-noprefix expl 'remote branch name' compadd $* - $branch_names + _wanted remote-branch-names-noprefix expl 'remote branch name' compadd "$@" -a - branch_names } (( $+functions[__git_commits] )) || @@ -5582,7 +5575,7 @@ __git_heads () { done fi - _wanted heads expl head compadd $* - $heads + _wanted heads expl head compadd "$@" -a - heads } (( $+functions[__git_commit_objects] )) || @@ -5678,7 +5671,7 @@ __git_submodules () { submodules=(${${${(f)"$(_call_program submodules git submodule 2>/dev/null)"}#?* }%% *}) __git_command_successful $pipestatus || return 1 - _wanted submodules expl submodule compadd $* - $submodules + _wanted submodules expl submodule compadd "$@" -a - submodules } # Tag Argument Types @@ -5691,7 +5684,7 @@ __git_tags () { tags=(${${(f)"$(_call_program tagrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/}) __git_command_successful $pipestatus || return 1 - _wanted tags expl tag compadd $* - $tags + _wanted tags expl tag compadd "$@" -a - tags } (( $+functions[__git_commit_tags] )) || @@ -5714,7 +5707,7 @@ __git_tags_of_type () { tags=(${${(M)${(f)"$(_call_program $type-tag-refs "git for-each-ref --format='%(*objecttype)%(objecttype) %(refname)' refs/tags 2>/dev/null")"}:#$type(tag|) *}#$type(tag|) refs/tags/}) __git_command_successful $pipestatus || return 1 - _wanted $type-tags expl "$type tag" compadd $* - $tags + _wanted $type-tags expl "$type tag" compadd "$@" -a - tags } # Reference Argument Types @@ -5737,7 +5730,7 @@ __git_references () { _git_refs_cache_pwd=$PWD fi - _wanted references expl 'references' compadd - $_git_refs_cache + _wanted references expl 'reference' compadd -a - _git_refs_cache } (( $+functions[__git_local_references] )) || @@ -5750,7 +5743,7 @@ __git_local_references () { _git_local_refs_cache_pwd=$PWD fi - _wanted references expl 'references' compadd - $_git_local_refs_cache + _wanted references expl 'reference' compadd -a - _git_local_refs_cache } (( $+functions[__git_remote_references] )) || @@ -5766,7 +5759,7 @@ __git_notes_refs () { notes_refs=(${${(f)"$(_call_program notes-refs git for-each-ref --format='"%(refname)"' refs/notes 2>/dev/null)"}#$type refs/notes/}) __git_command_successful $pipestatus || return 1 - _wanted notes-refs expl 'notes ref' compadd $* - $notes_refs + _wanted notes-refs expl 'notes ref' compadd "$@" -a - notes_refs } # File Argument Types @@ -6406,7 +6399,6 @@ __git_config_values () { # Git Config Sections and Types (( $+functions[__git_browsers] )) || __git_browsers () { - integer ret=1 local expl declare -a userbrowsers builtinbrowsers @@ -6431,16 +6423,9 @@ __git_browsers () { cygstart xdg-open) - _tags user-browsers builtin-browsers - - while _tags; do - _requested user-browsers expl 'user-defined browser' compadd $* - $userbrowsers && ret=0 - _requested builtin-browsers expl 'builtin browser' compadd $* - $builtinbrowsers && ret=0 - - (( ret )) || break - done - - return ret + _alternative \ + 'user-browsers:user-defined browser:compadd -a - userbrowsers' \ + 'builtin-browsers:builtin browser:compadd -a - builtinbrowsers' } (( $+functions[__git_difftools] )) || @@ -6483,10 +6468,10 @@ __git_diff-or-merge-tools () { esac while _tags; do - _requested user-difftools expl 'user-defined difftool' compadd $* - $userdifftools && ret=0 - _requested user-mergetools expl 'user-defined mergetool' compadd $* - $usermergetools && ret=0 - _requested builtin-difftools expl 'builtin difftool' compadd $* - $builtindifftools && ret=0 - _requested builtin-mergetools expl 'builtin mergetool' compadd $* - $builtinmergetools && ret=0 + _requested user-difftools expl 'user-defined difftool' compadd "$@" -a - userdifftools && ret=0 + _requested user-mergetools expl 'user-defined mergetool' compadd "$@" -a - usermergetools && ret=0 + _requested builtin-difftools expl 'builtin difftool' compadd "$@" -a - builtindifftools && ret=0 + _requested builtin-mergetools expl 'builtin mergetool' compadd "$@" -a - builtinmergetools && ret=0 (( ret )) || break done @@ -6577,20 +6562,18 @@ __git_sendemail_suppresscc_values () { (( $+functions[__git_colors] )) || __git_colors () { - declare -a colors + declare -a expl - colors=(black red green yellow blue magenta cyan white) - - _describe -t colors color colors $* + _wanted colors expl color compadd "$@" - \ + black red green yellow blue magenta cyan white } (( $+functions[__git_color_attributes] )) || __git_color_attributes () { - declare -a attributes - - attributes=(bold dim ul blink reverse) + declare -a expl - _describe -t attributes attribute attributes $* + _wanted attributes expl attribute compadd "$@" - \ + bold dim ul blink reverse } # Now, for the main drive... @@ -6657,12 +6640,12 @@ _git() { (option-or-argument) curcontext=${curcontext%:*:*}:git-$words[1]: - if (( $+functions[_git-$words[1]] )); then - _call_function ret _git-$words[1] - elif zstyle -T :completion:$curcontext: use-fallback; then - _files && ret=0 - else - _message 'unknown sub-command' + if ! _call_function ret _git-$words[1]; then + if zstyle -T :completion:$curcontext: use-fallback; then + _default && ret=0 + else + _message "unknown sub-command: $words[1]" + fi fi ;; esac diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less index ede54a49c..a3ba8f665 100644 --- a/Completion/Unix/Command/_less +++ b/Completion/Unix/Command/_less @@ -24,8 +24,8 @@ if compset -P '+[-0-9]#'; then g:goto\ line F:scroll\ to\ end\ and\ keep\ reading\ file G:go\ to\ end\ of\ file - %:go\ to\ position\ in\ file - p:go\ to\ position\ in\ file + %:go\ to\ position\ in\ file + p:go\ to\ position\ in\ file )' return fi @@ -101,9 +101,9 @@ if [[ -n "$state" ]]; then ;; tags) if (( $+LESSGLOBALTAGS )); then - _global_tags + _global_tags && ret=0 else - _ctags_tags + _ctags_tags && ret=0 fi ;; esac diff --git a/Completion/Unix/Command/_lha b/Completion/Unix/Command/_lha index 5a238d807..c2d5e7d8d 100644 --- a/Completion/Unix/Command/_lha +++ b/Completion/Unix/Command/_lha @@ -5,16 +5,16 @@ if (( CURRENT == 2 )); then local lhacmds lhacmds=( - '( x l v u d m c p t)a[Add \(Or replace\) to archive]' - '(a l v u d m c p t)x[EXtract from archive]' - '(a x v u d m c p t)l[List]' - '(a x l u d m c p t)v[Verbose List]' - '(a x l v d m c p t)u[Update newer files to archive]' - '(a x l v u m c p t)d[Delete from archive]' - '(a x l v u d c p t)m[Move to archive]' - '(a x l v u d m p t)c[re-Construct new archive]' - '(a x l v u d m c t)p[Print to STDOUT from archive]' - '(a x l v u d m c p )t[Test file CRC in archive]' + '( x l v u d m c p t)a[add \(or replace\) to archive]' + '(a l v u d m c p t)x[extract from archive]' + '(a x v u d m c p t)l[list]' + '(a x l u d m c p t)v[verbose List]' + '(a x l v d m c p t)u[update newer files to archive]' + '(a x l v u m c p t)d[delete from archive]' + '(a x l v u d c p t)m[move to archive]' + '(a x l v u d m p t)c[re-construct new archive]' + '(a x l v u d m c t)p[print to stdout from archive]' + '(a x l v u d m c p )t[test file CRC in archive]' ) if [ "${words[2]#-}" != "" ]; then @@ -23,22 +23,22 @@ if (( CURRENT == 2 )); then 'q[quiet]' 'n[not execute]' 'f[force\(over write at extract\)]' - 't[FILES are TEXT file]' - 'e[TEXT code convert from/to EUC]' - 'g[Generic format \(for compatibility\)]' + 't[files are text files]' + 'e[text code convert from/to EUC]' + 'g[use generic format \(for compatibility\)]' ) case ${words[2]#-} in a*|u*) lhacmds=($lhacmds - 'd[delete FILES after]' - 'z[files not compress]' + 'd[delete files after]' + "z[don't compress files]" '( 1 2)0[header level 0]' '(0 2)1[header level 1]' '(0 1 )2[header level 2]' ) ;; c*) - lhacmds=($lhacmds 'd[delete FILES after]') + lhacmds=($lhacmds 'd[delete files after]') ;; x*) lhacmds=($lhacmds 'i[ignore directory path]') @@ -46,32 +46,25 @@ if (( CURRENT == 2 )); then esac fi - _values -s '' 'lha command' \ - $lhacmds \ - && return 0 + _values -s '' 'lha command' $lhacmds elif (( CURRENT == 3 )); then - _arguments -C \ - '*:LHA file:_files -g \*.lzh' && return 0 + _wanted files expl 'lha file' _files -g '*.lzh(-.)' else case ${words[2]#-} in l*|x*|d*) if [ -f "$words[3]" ]; then - _lzh_cache_list=`$words[1] lq $words[3] | awk '{print $8}'` + _lzh_cache_list=`$words[1] lq $words[3] | awk '{print $NF}'` _lzh_cache_list=("${(@f)${_lzh_cache_list}}") _wanted files expl 'file from archive' _multi_parts / _lzh_cache_list - - return 0 else - _message -r "Archive file is not found : ${words[3]}" + _message -r "archive file is not found : ${words[3]}" return 1 fi ;; *) - _arguments -C \ - '*:file:_files' && return 0 + _files + ;; esac fi - -return 0 diff --git a/Completion/Unix/Command/_metaflac b/Completion/Unix/Command/_metaflac index 14095e9f9..65b9eb292 100644 --- a/Completion/Unix/Command/_metaflac +++ b/Completion/Unix/Command/_metaflac @@ -1,16 +1,13 @@ #compdef metaflac local _metaflac_opts _metaflac_shorts _metaflac_opers -typeset -A opt_args -function _metaflac_tags () { - echo "\n\nBEEP - $line - BEEP\n\n" -} -_metaflac_opts=( - '--preserve-modtime' - '--with-filename[prefix output with filename]' - '--no-filename' + +_metaflac_opts=( + '--preserve-modtime' + '--with-filename[prefix output with filename]' + '--no-filename' '--no-utf8-convert' - '--dont-use-padding[always rewrite the file]' + '--dont-use-padding[always rewrite the file]' ) _metaflac_shorts=( '--show-md5sum' @@ -23,7 +20,7 @@ _metaflac_shorts=( '--show-bps' '--show-total-samples' '--show-vendor-tag' - '--show-tag=:FLAC tags:_metaflac_tags' + '--show-tag=:FLAC tags' '--remove-tag=:FLAC tags: ' '--remove-first-tag=:FLAC tags: ' '--remove-all-tags' @@ -51,9 +48,7 @@ _metaflac_opers=( _arguments "$_metaflac_opts[@]" \ "*:FLAC file:_files -g \*.flac\(-.\)" \ - - "shortcuts" \ + - "shortcuts" \ "$_metaflac_shorts[@]" \ - - "(operations)" \ - "$_metaflac_opers[@]" \ - && return 0 - + - "(operations)" \ + "$_metaflac_opers[@]" diff --git a/Completion/Unix/Command/_module b/Completion/Unix/Command/_module index c1c9f5c08..060f05b86 100644 --- a/Completion/Unix/Command/_module +++ b/Completion/Unix/Command/_module @@ -52,9 +52,9 @@ _module() ) if (( CURRENT == 1 )); then - _describe -t commands 'module command' _module_cmds || compadd "$@" + _describe -t commands 'module command' _module_cmds else - local curcontext="$curcontext" + local curcontext="$curcontext" ret cmd="${${_module_cmds[(r)$words[1]:*]%%:*}}" # Deal with any aliases @@ -65,7 +65,7 @@ _module() show) cmd="display";; keyword) cmd="apropos";; esac - + if (( $#cmd )); then local update_policy @@ -132,7 +132,7 @@ _module_available_modules() { _arguments -s \ '(-a --append)'{--append,-a}'[append the directories instead of prepending]' \ - '*:directory:_files -/' + '*:directory:_files -/' } # Completion function for unuse diff --git a/Completion/Unix/Command/_monotone b/Completion/Unix/Command/_monotone index 83e18e306..bcaab87f0 100644 --- a/Completion/Unix/Command/_monotone +++ b/Completion/Unix/Command/_monotone @@ -1,8 +1,22 @@ #compdef mtn -local context state line ret -typeset -a cmds -typeset -A opt_args +local -a cmds +cmds=( + automate:automation db:database fdiff:debug fload:debug fmerge:debug + get_roster:debug identify:debug rcs_import:debug annotate:informative + cat:informative complete:informative diff:informative help:informative + list:informative log:informative ls:informative show_conflicts:informative + status:informative cert:key+cert chkeypass:key+cert dropkey:key+cert + genkey:key+cert trusted:key+cert pull:network push:network serve:network + sync:network privkey:packet\ i/o pubkey:packet\ i/o read:packet\ i/o + cvs_import:rcs approve:review comment:review disapprove:review tag:review + testresult:review checkout:tree co:tree explicit_merge:tree heads:tree + merge:tree merge_into_dir:tree migrate_workspace:tree propagate:tree + refresh_inodeprints:tree setup:tree set:vars unset:vars add:workspace + attr:workspace ci:workspace commit:workspace drop:workspace mv:workspace + pivot_root:workspace pluck:workspace rename:workspace revert:workspace + rm:workspace update:workspace +) _arguments \ '--brief[print a brief version of the normal output]' \ @@ -25,17 +39,5 @@ _arguments \ '--ticker[set ticker style]:ticker style:(count dot none)' \ '--version[print version number, then exit]' \ '(-@ --xargs)'{-@,--xargs}'[insert command line arguments taken from the given file]:file:_files' \ - '*:command:->cmd' && return 0 - -case "$state" in - (cmd) - if (( CURRENT == 2 )); then - cmds=(automate:automation db:database fdiff:debug fload:debug fmerge:debug get_roster:debug identify:debug rcs_import:debug annotate:informative cat:informative complete:informative diff:informative help:informative list:informative log:informative ls:informative show_conflicts:informative status:informative cert:key+cert chkeypass:key+cert dropkey:key+cert genkey:key+cert trusted:key+cert pull:network push:network serve:network sync:network privkey:packet\ i/o pubkey:packet\ i/o read:packet\ i/o cvs_import:rcs approve:review comment:review disapprove:review tag:review testresult:review checkout:tree co:tree explicit_merge:tree heads:tree merge:tree merge_into_dir:tree migrate_workspace:tree propagate:tree refresh_inodeprints:tree setup:tree set:vars unset:vars add:workspace attr:workspace ci:workspace commit:workspace drop:workspace mv:workspace pivot_root:workspace pluck:workspace rename:workspace revert:workspace rm:workspace update:workspace) - _describe -t commands 'cmds' cmds && ret=0 - else - _files - fi - ;; -esac - -return ret + '1:command: _describe -t commands command cmds' \ + '*:file:_files' diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc index 12707677f..11eab8463 100644 --- a/Completion/Unix/Command/_mpc +++ b/Completion/Unix/Command/_mpc @@ -68,21 +68,21 @@ _mpc_command() { ) if (( CURRENT == 1 )); then - _describe -t command "mpc commands" mpc_cmds + _describe -t commands "mpc command" mpc_cmds else - local curcontext="$curcontext" + local cmd=$words[1] + local curcontext="${curcontext%:*}:mpc-${cmd}" ret=1 + if ! _call_function ret _mpc_$cmd; then + _default && ret=0 + fi + return ret fi - - local cmd=$words[1] - - local curcontext="${curcontext%:*}:mpc-${cmd}" - _call_function ret _mpc_$cmd } _mpc_helper_bool() { local expl states states=(on off yes no 1 0 true false) - _wanted states expl boolean compadd $expl -a states + _wanted states expl boolean compadd -a states } (( $+functions[_mpc_helper_songnumbers] )) || @@ -100,7 +100,7 @@ _mpc_helper_songnumbers() { NM="$compstate[nmatches]" fi - out=("${(@f)$(_call_program song-numbers mpc $foo playlist 2>/dev/null)}") + out=("${(@f)$(_call_program song-numbers mpc $foo playlist)}") out=("${(@M)out[@]:#${~MATCH}}") sn=("${(@)${(@M)out}//(#b)(#s)(\#|[ >]#)([0-9]#)*/$match[2]}") diff --git a/Completion/Unix/Command/_netcat b/Completion/Unix/Command/_netcat index 396fc8e09..4e4006b30 100644 --- a/Completion/Unix/Command/_netcat +++ b/Completion/Unix/Command/_netcat @@ -1,11 +1,10 @@ #compdef nc netcat -local curcontext="$curcontext" state line expl -typeset -A opt_args - # handle name clash with the nedit client -[[ $service = nc ]] && ! _pick_variant netcat=connect nedit -h && - _nedit && return +if [[ $service = nc ]] && ! _pick_variant netcat=connect nedit -h; then + _nedit + return +fi if (( ! $+_nc_args )); then local help="$(_call_program options $words[1] -h < /dev/null 2>&1)" @@ -14,17 +13,17 @@ if (( ! $+_nc_args )); then '*-e prog*' '-e+[program to exec after connect]:prog:_command_names -e' '*-g gateway*' '-g+[source-routing hop point]:gateway:_hosts' '*-G num*' '-G[source-routing pointer: 4, 8, 12]' - '*-i secs*' '-i+[delay interval for lines sent or ports scanned]:secs:' + '*-i secs*' '-i+[delay interval for lines sent or ports scanned]:delay (secs)' '*-l*' '-l[listen mode]' '*-n*' '-n[numeric-only IP addresses, no DNS]' '*-o file*' '-o+[hex dump of traffic]:file:_files' '*-p port*' '-p+[local port number]:port:_ports' '*-r*' '-r[randomize local and remote ports]' - '*-q secs*' '-q+[quit after EOF on stdin and delay of secs]:secs:' + '*-q secs*' '-q+[quit after EOF on stdin and delay of secs]:delay (secs)' '*-t*' '-t[answer TELNET negotiation]' '*-u*' '-u[UDP mode]' '*-v*' '-v[verbose]' - '*-w secs*' '-w+[timeout for connects and final net reads]:secs:' + '*-w secs*' '-w+[timeout for connects and final net reads]:timeout (secs)' '*-z*' '-z[zero-I/O mode]' '*-x*' '-x' '*-b*' '-b[allow broadcasts]' @@ -32,7 +31,7 @@ if (( ! $+_nc_args )); then _nc_args=($optionmap[(K)"$help"]) fi -_arguments -C -s \ +_arguments -s \ "$_nc_args[@]" \ ':host:_hosts' \ - ':port:_ports' && return 0 + ':port:_ports' diff --git a/Completion/Unix/Command/_notmuch b/Completion/Unix/Command/_notmuch index b576d2b29..d6cc58deb 100644 --- a/Completion/Unix/Command/_notmuch +++ b/Completion/Unix/Command/_notmuch @@ -57,12 +57,15 @@ _notmuch_search() _notmuch() { + local ret=1 if (( CURRENT > 2 )) ; then local cmd=${words[2]} curcontext="${curcontext%:*:*}:notmuch-$cmd" (( CURRENT-- )) shift words - _call_function ret _notmuch_$cmd + if ! _call_function ret _notmuch_$cmd; then + _default && ret=0 + fi return ret else _notmuch_commands diff --git a/Completion/Unix/Command/_pkg-config b/Completion/Unix/Command/_pkg-config index 48b788a1b..e44b36897 100644 --- a/Completion/Unix/Command/_pkg-config +++ b/Completion/Unix/Command/_pkg-config @@ -1,6 +1,6 @@ #compdef pkg-config -local arguments packages curcontext="$curcontext" stat line +local arguments packages curcontext="$curcontext" state line ret=1 declare -A opt_args arguments=( @@ -11,31 +11,33 @@ arguments=( "--print-errors[cause errors to be printed]" "--silence-errors[prevent the printing of errors]" "--errors-to-stdout[print errors to stdout rather than stderr]" - "--cflags[prints the preprocessor and compile flags]" + "--cflags[print the preprocessor and compiler flags]" "--cflags-only-I[output -I flags only]" "--cflags-only-other[output cflags not covered by the cflags-only-I option]" "--debug[show verbose debug information]" - "--libs[prints the link flags]" - "--libs-only-L[prints the -L and -R parts of \"--libs\"]" - "--libs-only-l[prints the -l part of \"--libs\"]" + "--libs[print the link flags]" + "--libs-only-L[print the -L and -R parts of \"--libs\"]" + "--libs-only-l[print the -l part of \"--libs\"]" "--libs-only-other[output other libs]" "--list-all[list all known packages]" "--variable=[return the value of the specified variable]:variable" "--define-variable=[set the global value for a variable]:name value pair" - "--uninstalled[return successfully if any \"-uninstalled\" packages are being used and fails otherwise]" - "--exists[tests whether the package exists or not]" + "--uninstalled[return success if any \"-uninstalled\" packages are being used]" + "--exists[test whether the package exists or not]" "--atleast-version=[test whether the version is at least that of the specified value]:least value" "--exact-version=[test whether the version is exactly that of the specified value]:exact value" "--max-version=[test whether the version is no greater than some specific value]:max version" # "--msvc-syntax[output linker flags in a form compatible with MSVC++ (Windows only)]" # "--dont-define-prefix[disables automatic overiding of the variable \"prefix\" (Windows only)]" # "--prefix-variable=[set the name of the variable \"prefix\" (Windows only)]:prefix value" - "*:package name:->package" + "*: :->packages" ) -_arguments -C $arguments +_arguments -C $arguments && ret=0 if [[ -n $state ]] ; then - packages=( ${(f)"$((pkg-config --list-all | cut -d' ' -f1) 2>/dev/null)"} ) - compadd -a - packages + packages=( ${${(f)"$(_call_program packages pkg-config --list-all)"}%% *} ) + _wanted packages expl 'package' compadd -a - packages && ret=0 fi + +return ret diff --git a/Completion/Unix/Command/_prove b/Completion/Unix/Command/_prove index 75e83c360..1f21423e6 100644 --- a/Completion/Unix/Command/_prove +++ b/Completion/Unix/Command/_prove @@ -45,7 +45,7 @@ _arguments \ '--source=[load or configure a SourceHandler]:source:' \ {-a,--archive}'[store output in archive file]:file:_files' \ {-j,--jobs}'[run N jobs in parallel]:jobs:' \ - '*--state=[control persistent state]:state:' \ + '*--state=[control persistent state]: :_values -s , state last failed passed all hot todo slow fast new old fresh save' \ '--rc=[custom rcfile]:file:_files' \ - '*:file or directory:_files' \ - && return 0 + '*--rules=[limit tests run (or not) in parallel]:rules' \ + '*:file or directory:_files' diff --git a/Completion/Unix/Command/_rar b/Completion/Unix/Command/_rar index 1e3a26166..e2081f6e7 100644 --- a/Completion/Unix/Command/_rar +++ b/Completion/Unix/Command/_rar @@ -38,7 +38,7 @@ common=( case $service in unrar) if (( CURRENT == 2 )); then - _values 'rar command' \ + _values 'rar command' \ 'e[extract files to current directory]' \ 'l[list archive]' \ 'lt[list archive (technical format)]' \ @@ -48,7 +48,7 @@ case $service in 'v[verbosely list archive]' \ 'vt[verbosely list archive (technical format)]' \ 'vb[verbosely list archive (bare format)]' \ - 'x[extract files with full path]' && return + 'x[extract files with full path]' else _arguments -S \ '-ep3[expand paths to full including the drive letter]' \ @@ -58,7 +58,7 @@ case $service in '-n+:file to include:_files' \ '-n@+:file of files to include:_files' \ "$common[@]" \ - '*:RAR files:_files -g \*.rar\(-.\)' && return + '*:RAR files:_files -g \*.rar\(-.\)' fi ;; rar) @@ -89,7 +89,7 @@ case $service in 'v[verbosely list archive]' \ 'vt[verbosely list archive (technical format)]' \ 'vb[verbosely list archive (bare format)]' \ - 'x[extract files with full path]' && return + 'x[extract files with full path]' else _arguments -S \ '-ag[generate archive name using the current date]' \ @@ -126,7 +126,7 @@ case $service in '-w+[assign work directory]:work directory:_files -/' \ "$common[@]" \ '-z+[read archive comment from file]:comment file:_files' \ - '*:files:_files' && return + '*:files:_files' fi ;; esac diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync index 7bad03a05..79d8243e1 100644 --- a/Completion/Unix/Command/_rsync +++ b/Completion/Unix/Command/_rsync @@ -35,10 +35,10 @@ if compset -P '*::*/' || compset -P 'rsync://*/*/'; then # attrs size date time name _wanted files expl 'remote file or directory' \ - compadd -d remdispf ${${${${remdispf##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##} + compadd -d remdispf ${${${${remdispf##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##} && ret=0 _wanted files expl 'remote file or directory' \ - compadd -S/ -d remdispd ${${${${remdispd##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##} + compadd -S/ -d remdispd ${${${${remdispd##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##} || (( ! ret )) elif compset -P 1 '*::' || compset -P 1 'rsync://*/'; then diff --git a/Completion/Unix/Command/_rubber b/Completion/Unix/Command/_rubber index 09e289aa2..f66540a9f 100644 --- a/Completion/Unix/Command/_rubber +++ b/Completion/Unix/Command/_rubber @@ -15,24 +15,24 @@ else fi _rubber_args=( - \*{-c,--command}'=[run the directive CMD before parsing]:command' - \*{-e,--epilogue}'=[run the directive CMD after parsing]:command' - {-z,--gzip}'[compress the final document]' - '(- *)'{-h,--help}'[show help]' - '--into=[go to directory DIR before compiling]:directory:_files -/' - {-l,--landscape}'[change paper orientation (if relevant)]' - {-n,--maxerr}'=[display at most NUM errors]:num' - \*{-m,--module}'=[use module]:module:($_rubber_modules)' - '--only=[only include the specified SOURCES]:sources' - \*{-o,--post}'=[postprocess with module]:postprocessor:($_rubber_modules)' - {-d,--pdf}'[produce PDF output instead of DVI]' - {-p,--ps}'[produce a PostScript document]' - {-q,--quiet}'[suppress messages]' - \*{-r,--read}'[read additional directives from a file]:directives files:_files' - {-s,--short}'[display errors in a compact form]' - \*{-I,--texpath}'=[add DIR to the search path for LaTeX]:tex path:_files -/' - \*{-v,--verbose}'[increase verbosity]' - '--version[print version information and exit]' + \*{-c,--command}'=[run specified directive command before parsing]:command' + \*{-e,--epilogue}'=[run specified directive command after parsing]:command' + '(-z --gzip)'{-z,--gzip}'[compress the final document]' + '(- *)'{-h,--help}'[show help information]' + '--into=[go to specified directory before compiling]:directory:_files -/' + '(-l --landscape)'{-l,--landscape}'[change paper orientation (if relevant)]' + '(-n --maxerr)'{-n,--maxerr}'=[display at most specified number of errors]:number' + \*{-m,--module}'=[use module]:module:($_rubber_modules)' + '--only=[only include the specified sources]:sources' + \*{-o,--post}'=[postprocess with module]:postprocessor:($_rubber_modules)' + '(-d --pdf -p -ps)'{-d,--pdf}'[produce PDF output instead of DVI]' + '(-p -ps -d --pdf)'{-p,--ps}'[produce a PostScript document]' + {-q,--quiet}'[suppress messages]' + \*{-r,--read}'[read additional directives from a file]:directives files:_files' + {-s,--short}'[display errors in compact form]' + \*{-I,--texpath}'=[add directory to the search path for LaTeX]:tex path:_files -/' + \*{-v,--verbose}'[increase verbosity]' + '--version[print version information and exit]' ) case "$service" in @@ -42,17 +42,15 @@ case "$service" in '--clean[remove produced files instead of compiling]' \ {-f,--force}'[force at least one compilation]' \ '--inplace[compile the documents from their source directory]' \ - \*{-W,--warn}'=[report warnings of the given TYPE]:warnings:(all boxes misc refs)' \ + \*{-W,--warn}'=[report warnings of the given type]:warnings:(all boxes misc refs)' \ '*:LaTeX files:_files -g "*.(tex|dtx|lhs|w)(-.)"' - return 0 ;; rubber-pipe) _arguments -s \ "$_rubber_args[@]" \ {-k,--keep}'[keep the temporary files after compiling]' \ - \*{-W,--warn}'=[report warnings of the given TYPE]:warnings:(all boxes misc refs)' - return 0 + \*{-W,--warn}'=[report warnings of the given type]:warnings:(all boxes misc refs)' ;; rubber-info) @@ -65,8 +63,5 @@ case "$service" in '--refs[show the list of undefined references]' \ '--warnings[show all LaTeX warnings]' \ ':LaTeX file:_files -g "*.(tex|dtx|lhs|w)(-.)"' - return 0 ;; esac - -return 1 diff --git a/Completion/Unix/Command/_sablotron b/Completion/Unix/Command/_sablotron index 170f08abd..53e0bec92 100644 --- a/Completion/Unix/Command/_sablotron +++ b/Completion/Unix/Command/_sablotron @@ -20,15 +20,8 @@ _arguments -C \ if [[ -n "$state" ]]; then mode="${opt_args[(i)-c|--chain-xsl]:+chain}${opt_args[(i)-x|--batch-xml]:+batch-x}${opt_args[(i)-s|--batch-xsl]:+batch-s}" [[ $mode = (chain|batch-[xs]) ]] || mode=default - _tags assignments files + _tags files assignments while _tags; do - if _requested assignments; then - if [[ -prefix *= ]]; then - _message -e value value - else - _message -e parameter 'parameter name' - fi - fi if _requested files; then case $mode:${#words[1,CURRENT-1]:#(-*|*=*)}; in default:1|chain:<3->|batch-x:2|batch-s:1) @@ -45,6 +38,13 @@ if [[ -n "$state" ]]; then ;; esac fi + if _requested assignments; then + if [[ -prefix *= ]]; then + _message -e value value + else + _message -e parameter 'parameter name' && ret=0 + fi + fi (( ret )) || break done fi diff --git a/Completion/Unix/Command/_screen b/Completion/Unix/Command/_screen index 931946c78..510fd7195 100644 --- a/Completion/Unix/Command/_screen +++ b/Completion/Unix/Command/_screen @@ -1,20 +1,8 @@ #compdef screen -local curcontext="$curcontext" state line expl +local curcontext="$curcontext" state line expl ret=1 local scr_cmds sessions -function __screen_normal() { - if (( CURRENT == 1 )) && [[ $PREFIX == /dev/* ]]; then - _path_files -g '*(%)' - elif (( CURRENT == 2 )) && [[ ${words[1]} == /dev/* ]]; then - _message "baud rate" - elif (( CURRENT > 2 )) && [[ ${words[1]} == /dev/* ]]; then - _message "no more parameters" - else - _normal "$@" - fi -} - scr_cmds=( acladd aclchg acldel aclgrp aclumask activity addacl allpartial @@ -103,10 +91,21 @@ _arguments -C \ '-Dx: :->any-sessions' \ '-dx: :->any-sessions' \ '-X[execute command as a screen command in the specified session]:screencmd:(${scr_cmds[@]})' \ - '*::arguments: __screen_normal' + '*:: :->normal' && ret=0 if [[ -n $state ]]; then case $state in + normal) + if (( CURRENT == 1 )) && [[ $PREFIX == /dev/* ]]; then + _path_files -g '*(%)' + elif (( CURRENT == 2 )) && [[ ${words[1]} == /dev/* ]]; then + _message "baud rate" + elif (( CURRENT > 2 )) && [[ ${words[1]} == /dev/* ]]; then + _message "no more parameters" + else + _normal + fi + ;; attached-sessions) sessions=( ${${${(M)${(f)"$(_call_program screen-sessions $words[1] \ @@ -134,4 +133,6 @@ if [[ -n $state ]]; then _wanted screen-sessions expl "${state%-*} screen process" \ compadd ${sessions#*.} fi -fi +fi && ret=0 + +return ret diff --git a/Completion/Unix/Command/_stgit b/Completion/Unix/Command/_stgit index 6248267eb..f313f651a 100644 --- a/Completion/Unix/Command/_stgit +++ b/Completion/Unix/Command/_stgit @@ -40,11 +40,11 @@ else compadd ${${(M)${(f)"$(stg series 2> /dev/null)"}##[+>] *}#[+>] } \ && ret=0 else - _files + _files && ret=0 fi ;; (*) - _files + _files && ret=0 ;; esac fi diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip index 06f7243b5..726d87c2b 100644 --- a/Completion/Unix/Command/_strip +++ b/Completion/Unix/Command/_strip @@ -1,6 +1,6 @@ #compdef strip -local curcontext=$curcontext state line ret=0 +local curcontext=$curcontext state line ret=1 declare -A opt_args declare -a args @@ -11,8 +11,8 @@ if _pick_variant gnu=GNU solaris --version; then local expl _description files expl 'command-line-options file' - _files $expl && ret=0 - return $ret + _files "$expl[@]" + return fi args=( '(-F --target)'{-F+,--target=}'[object code format to use]:bfd name:->bfdnames' @@ -52,9 +52,9 @@ case $state in local expl declare -a bfdnames - bfdnames=(${=${(M)${(f)"$(_call_program bfdnames strip --help 2>/dev/null)"}:#strip: supported targets: *}#strip: supported targets: }) + bfdnames=(${=${(M)${(f)"$(_call_program bfdnames strip --help)"}:#strip: supported targets: *}#strip: supported targets: }) _describe -t bfdnames 'bfd name' bfdnames && ret=0 ;; esac -return $ret +return ret diff --git a/Completion/Unix/Command/_systemd b/Completion/Unix/Command/_systemd index d2a7895e1..028ecddd9 100644 --- a/Completion/Unix/Command/_systemd +++ b/Completion/Unix/Command/_systemd @@ -132,9 +132,9 @@ _hosts_or_user_at_host() ) if (( CURRENT == 1 )); then - _describe -t commands 'systemctl command' _systemctl_cmds || compadd "$@" + _describe -t commands 'systemctl command' _systemctl_cmds else - local curcontext="$curcontext" + local curcontext="$curcontext" ret cmd="${${_systemctl_cmds[(r)$words[1]:*]%%:*}}" # Deal with any aliases diff --git a/Completion/Unix/Command/_telnet b/Completion/Unix/Command/_telnet index c7ab34f98..1674eedd8 100644 --- a/Completion/Unix/Command/_telnet +++ b/Completion/Unix/Command/_telnet @@ -12,8 +12,8 @@ if (( ! $+_telnet_args )); then local help="$(_call_program options 'telnet -\?' < /dev/null 2>&1)" local -A optionmap optionmap=( - '*\[-4\]*' '-4[Force IPv4 address resolution]' - '*\[-6\]*' '-6[Force IPv6 address resolution]' + '*\[-4\]*' '-4[force IPv4 address resolution]' + '*\[-6\]*' '-6[force IPv6 address resolution]' '*\[-8\]*' '-8[allow 8-Bit data]' '*\[-E\]*' '-E[disable an escape character]' '*\[-K\]*' '-K[no automatic login]' @@ -52,16 +52,16 @@ _arguments -C -s \ case "$state" in ssl) _values -w 'SSL parameter' \ - 'debug[Send SSL debugging info to stderr]' \ - '(nossl)ssl[Negotiate SSL connection]' \ - '(ssl)nossl[Switch off SSL negotiation]' \ - 'certrequired[Require server certificate]' \ - 'secure[No fallback to unencrypted mode]' \ - 'verbose[Be verbose about certificates, etc.]' \ - 'verify[Set SSL verify flags]:int:' \ - 'cert[Specify certificate file]:certificate file:_path_files' \ - 'key[Specify key file]:key file:_path_files' \ - 'cipher[Set preferred cipher list]:ciphers:' + 'debug[send SSL debugging info to stderr]' \ + '(nossl)ssl[negotiate SSL connection]' \ + '(ssl)nossl[switch off SSL negotiation]' \ + 'certrequired[require server certificate]' \ + 'secure[no fallback to unencrypted mode]' \ + 'verbose[be verbose about certificates, etc.]' \ + 'verify[set SSL verify flags]:int' \ + 'cert[specify certificate file]:certificate file:_path_files' \ + 'key[specify key file]:key file:_path_files' \ + 'cipher[set preferred cipher list]:cipher' && ret=0 ;; hosts) diff --git a/Completion/Unix/Command/_tidy b/Completion/Unix/Command/_tidy index fce719026..ec2d74238 100644 --- a/Completion/Unix/Command/_tidy +++ b/Completion/Unix/Command/_tidy @@ -123,6 +123,4 @@ _arguments \ '--css-prefix:CSS class name:' \ '--accessibility-check:priority level:(${access[@]})' \ '--newline:newline character:(LF CRLF CR)' \ - '*:file:_files' && return - -return 1 + '*:file:_files' diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux index 5a4a2d71f..f0cc4be37 100644 --- a/Completion/Unix/Command/_tmux +++ b/Completion/Unix/Command/_tmux @@ -1490,7 +1490,7 @@ function __tmux-windows() { # And here is the actual _tmux(), that puts it all together: function _tmux() { local curcontext="${curcontext}" - local mode state ret + local mode state ret=1 local -a args local -x tmuxcommand unset tmux_describe @@ -1508,22 +1508,22 @@ function _tmux() { '-v[request verbose logging]' '*:: :->subcommand_or_options' ) - _arguments -C -s -w ${args} && return + _arguments -C -s -w ${args} && ret=0 if [[ ${state} == "subcommand_or_options" ]]; then if (( CURRENT == 1 )) ; then zstyle -s ":completion:${curcontext}:subcommands" mode mode || mode='both' if [[ ${mode} == 'commands' ]]; then - _describe -t subcommands 'tmux commands' _tmux_commands + _describe -t subcommands 'tmux commands' _tmux_commands && ret=0 elif [[ ${mode} == 'aliases' ]]; then - _describe -t subcommands 'tmux aliases' _tmux_aliases + _describe -t subcommands 'tmux aliases' _tmux_aliases && ret=0 else - _describe -t subcommands 'tmux commands and aliases' _tmux_commands -- _tmux_aliases + _describe -t subcommands 'tmux commands and aliases' _tmux_commands -- _tmux_aliases && ret=0 fi else if (( ${+commands[tmux]} == 0 )); then _message '`tmux'\'' not found in $path; sub-cmd completions disabled.' - return 0 + return fi tmuxcommand="${words[1]}" if [[ -n ${_tmux_aliasmap[$tmuxcommand]} ]] ; then @@ -1545,6 +1545,7 @@ function _tmux() { _call_function ret _tmux-${tmuxcommand} fi fi + return ret } # description generation follows; only done on 1st _tmux call. diff --git a/Completion/Unix/Command/_vcsh b/Completion/Unix/Command/_vcsh index 47dbd9e69..00aed7d28 100644 --- a/Completion/Unix/Command/_vcsh +++ b/Completion/Unix/Command/_vcsh @@ -1,60 +1,29 @@ #compdef vcsh function __vcsh_repositories () { - local expl local -a repos - repos=( ${(f)"$(command vcsh list)"} ) - _describe -t repos 'repositories' repos -} - -function __vcsh_not_implemented_yet () { - _message "Subcommand completion '${1#*-}': not implemented yet" + repos=( ${(f)"$(_call_program repositories vcsh list)"} ) + _describe -t repositories 'repository' repos } function _vcsh-clone () { - __vcsh_not_implemented_yet "$0" #TODO -} - -function _vcsh-delete () { - (( CURRENT == 2 )) && __vcsh_repositories + _default #TODO } -function _vcsh-enter () { - (( CURRENT == 2 )) && __vcsh_repositories -} - -function _vcsh-help () { - _nothing -} - -function _vcsh-init () { - _nothing -} - -function _vcsh-list () { - _nothing -} - -function _vcsh-list-tracked () { - _nothing -} - -function _vcsh-list-tracked-by () { - (( CURRENT == 2 )) && __vcsh_repositories -} - -function _vcsh-pull () { - _nothing -} - -function _vcsh-push () { - _nothing -} +local func +for func in help init list list-tracked pull push version; do + _vcsh-$func() { _nothing } +done +for func in delete enter list-tracked-by upgrade write-gitignore; do + _vcsh-$func() { (( CURRENT == 2 )) && __vcsh_repositories } +done function _vcsh-rename () { - (( CURRENT == 2 )) && __vcsh_repositories - (( CURRENT == 3 )) && _message "new repository name" - (( CURRENT > 3 )) && _nothing + case $CURRENT in + 2) __vcsh_repositories ;; + 3) _message "new repository name" ;; + *) _nothing ;; + esac } function _vcsh-run () { @@ -66,24 +35,8 @@ function _vcsh-run () { fi } -function _vcsh-upgrade () { - (( CURRENT == 2 )) && __vcsh_repositories -} - -function _vcsh-version () { - _nothing -} - -function _vcsh-which () { - _files -} - -function _vcsh-write-gitignore () { - (( CURRENT == 2 )) && __vcsh_repositories -} - function _vcsh () { - local curcontext="${curcontext}" + local curcontext="${curcontext}" ret=1 local state vcshcommand local -a args subcommands @@ -112,24 +65,25 @@ function _vcsh () { '*:: :->subcommand_or_options_or_repo' ) - _arguments -C ${args} && return + _arguments -C ${args} && ret=0 if [[ ${state} == "subcommand_or_options_or_repo" ]]; then if (( CURRENT == 1 )); then - _describe -t subcommands 'vcsh sub-commands' subcommands - __vcsh_repositories + _describe -t subcommands 'vcsh sub-commands' subcommands && ret=0 + __vcsh_repositories && ret=0 else vcshcommand="${words[1]}" if ! (( ${+functions[_vcsh-$vcshcommand]} )); then # There is no handler function, so this is probably the name # of a repository. Act accordingly. - _dispatch git git + _dispatch git git && ret=0 else curcontext="${curcontext%:*:*}:vcsh-${vcshcommand}:" _call_function ret _vcsh-${vcshcommand} fi fi fi + return ret } _vcsh "$@" diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool index 0f18eefb5..03ebd0642 100644 --- a/Completion/Unix/Command/_zpool +++ b/Completion/Unix/Command/_zpool @@ -12,7 +12,7 @@ _zpool() { ) versions=( - ${${${(M)"${(f)$(zpool upgrade -v)}":#[[:space:]]#<->*}##[[:space:]]}%%[[:space:]]*} + ${${${(M)"${(f)$(_call_program versions zpool upgrade -v)}":#[[:space:]]#<->*}##[[:space:]]}%%[[:space:]]*} ) ro_props=( @@ -87,15 +87,12 @@ _zpool() { if [[ $service == "zpool" ]]; then _arguments -C -A "-*" \ - '-\?[Help]' \ - '*::command:->subcmd' && return 0 + '-\?[show help information]' \ + '1:subcommand:compadd -a subcmds' \ + '*:: :->subcmd' && return - if (( CURRENT == 1 )); then - _wanted commands expl "zpool subcommand" compadd -a subcmds - return - fi service="$words[1]" - curcontext="${curcontext%:*}=$service:" + curcontext="${curcontext%:*}-$service:" fi case $service in diff --git a/Completion/Unix/Type/_users b/Completion/Unix/Type/_users index 3c8c7027b..2ea3b1455 100644 --- a/Completion/Unix/Type/_users +++ b/Completion/Unix/Type/_users @@ -3,8 +3,8 @@ local expl users if zstyle -a ":completion:${curcontext}:users" users users; then - _wanted users expl user compadd "$@" -a - users - return 0 + _wanted users expl user compadd "$@" -a - users + return fi _wanted users expl user compadd "$@" -k - userdirs |