zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 1/2] _apt: add completion for 'apt' command
@ 2014-04-06 16:04 Alessandro Ghedini
  2014-04-06 16:04 ` [PATCH 2/2] _apt: add completion for 'apt-mark' command Alessandro Ghedini
  0 siblings, 1 reply; 2+ messages in thread
From: Alessandro Ghedini @ 2014-04-06 16:04 UTC (permalink / raw)
  To: zsh-workers

---
 Completion/Debian/Command/_apt | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/Completion/Debian/Command/_apt b/Completion/Debian/Command/_apt
index b51b2fc..6f0bded 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 \
-- 
1.9.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] _apt: add completion for 'apt-mark' command
  2014-04-06 16:04 [PATCH 1/2] _apt: add completion for 'apt' command Alessandro Ghedini
@ 2014-04-06 16:04 ` Alessandro Ghedini
  0 siblings, 0 replies; 2+ messages in thread
From: Alessandro Ghedini @ 2014-04-06 16:04 UTC (permalink / raw)
  To: zsh-workers

From: Sebastian Ramacher <sebastian@ramacher.at>

Bug: https://bugs.debian.org/691526
---
 Completion/Debian/Command/_apt | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/Completion/Debian/Command/_apt b/Completion/Debian/Command/_apt
index 6f0bded..bf5343a 100644
--- a/Completion/Debian/Command/_apt
+++ b/Completion/Debian/Command/_apt
@@ -1,4 +1,4 @@
-#compdef apt apt-get apt-cache apt-cdrom apt-config
+#compdef apt apt-get apt-cache apt-cdrom apt-config apt-mark
 
 _apt () {
   case "$service" in
@@ -7,6 +7,7 @@ _apt () {
     apt-cache) _apt-cache "$@";;
     apt-cdrom) _apt-cdrom "$@";;
     apt-config) _apt-config "$@";;
+    apt-mark) _apt-mark "$@";;
     *) _message "unknown command $service";;
   esac
 }
@@ -619,4 +620,34 @@ _apt_caching_policy () {
      /var/lib/dpkg/available -nt "$1" ]]
 }
 
+_apt-mark () {
+  _apt_arguments _apt-mark_sm \
+    -h,--help:bool \
+    -v,--version:bool \
+    -f,--file:configfile \
+    -c,--config-file:configfile \
+    -o,--option:arbitem \
+    -qq:bool \
+    -s:bool \
+    -- \
+    /$'auto\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \
+    /$'manual\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \
+    /$'hold\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \
+    /$'unhold\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \
+    /$'showauto\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \
+    /$'showmanual\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \
+    /$'showhold\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \
+    /"[]"/	':argument-1::compadd "$expl_action[@]" auto manual hold unhold showauto showmanual showhold'
+
+  _apt-mark () {
+    local expl_action expl_packages
+    _description actions expl_action 'action'
+    _description packages expl_packages 'package'
+
+    _apt-mark_sm
+  }
+
+  _apt-mark "$@"
+}
+
 _apt "$@"
-- 
1.9.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-06 16:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-06 16:04 [PATCH 1/2] _apt: add completion for 'apt' command Alessandro Ghedini
2014-04-06 16:04 ` [PATCH 2/2] _apt: add completion for 'apt-mark' command Alessandro Ghedini

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).