diff options
author | Alessandro Ghedini <alessandro@ghedini.me> | 2014-04-06 18:04:38 +0200 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2014-04-06 17:26:29 +0100 |
commit | d397599cea5aa39492e5914c876a3991b8543445 (patch) | |
tree | ddb87405996b565e3b5e9d3e0a69c37927db68c6 /Completion | |
parent | fe40b9c2a3f7e3dc282caf033525c1b4d2b4ddab (diff) | |
download | zsh-d397599cea5aa39492e5914c876a3991b8543445.tar.gz zsh-d397599cea5aa39492e5914c876a3991b8543445.tar.xz zsh-d397599cea5aa39492e5914c876a3991b8543445.zip |
32532: completion for "apt" command
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Debian/Command/_apt | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/Completion/Debian/Command/_apt b/Completion/Debian/Command/_apt index b51b2fc74..6f0bded78 100644 --- a/Completion/Debian/Command/_apt +++ b/Completion/Debian/Command/_apt @@ -1,7 +1,8 @@ -#compdef apt-get apt-cache apt-cdrom apt-config +#compdef apt apt-get apt-cache apt-cdrom apt-config _apt () { case "$service" in + apt) _apt-cmd "$@";; apt-get) _apt-get "$@";; apt-cache) _apt-cache "$@";; apt-cdrom) _apt-cdrom "$@";; @@ -389,6 +390,38 @@ _apt_consume_long () { return 0 } +_apt-cmd () { + _apt_arguments _apt-cmd_sm \ + -h,--help:bool \ + -v,--version:bool \ + -c,--config-file:configfile \ + -o,--option:arbitem \ + -t,--target-release:release \ + -- \ + /$'list\0'/ \| \ + /$'search\0'/ /$'[^\0]#\0'/ ':strings:pattern:' \| \ + /$'show\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \ + /$'update\0'/ \| \ + \( \ + /$'install\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \ + /$'[^\0/]#/'/ /$'[^\0/]#\0'/ ':release name::_apt_releases' \) \| \ + /$'remove\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \ + /$'upgrade\0'/ \| \ + /$'full-upgrade\0'/ \| \ + /$'edit-sources\0'/ \| \ + /"[]"/ ':argument-1::compadd "$expl_action[@]" list search show update install remove upgrade full-upgrade edit-sources' + + _apt-cmd () { + local expl_action expl_packages + _description actions expl_action 'action' + _description packages expl_packages 'package' + + _apt-cmd_sm + } + + _apt-cmd "$@" +} + _apt-get () { _apt_arguments _apt-get_sm \ -h,--help:bool \ |