summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-05-04 06:03:37 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-05-04 20:50:34 +0000
commita6ab96822482c14a127d6f746dcf9f4ab838da81 (patch)
tree741b07fd3048ea5352c65d5e109d3e26ac4a3863
parent058d957ce53d98252ee7ca138b020a461d56a3f3 (diff)
downloadzsh-a6ab96822482c14a127d6f746dcf9f4ab838da81.tar.gz
zsh-a6ab96822482c14a127d6f746dcf9f4ab838da81.tar.xz
zsh-a6ab96822482c14a127d6f746dcf9f4ab838da81.zip
38399: _bts: Complete debbugs bug numbers from `bts cache`.
-rw-r--r--ChangeLog7
-rw-r--r--Completion/Debian/Command/_bts36
-rw-r--r--Completion/Debian/Command/_bug1
-rw-r--r--Completion/Debian/Type/_debbugs_bugnumber4
4 files changed, 30 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 48e10582f..1a96bcec9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-05-04  Daniel Shahaf  <d.s@daniel.shahaf.name>
+
+	* 38399: Completion/Debian/Command/_bts,
+	Completion/Debian/Command/_bug,
+	Completion/Debian/Type/_debbugs_bugnumber: _bts: Complete
+	debbugs bug numbers from `bts cache`.
+
 2016-05-03  Russell Currey  <ruscur@russell.cc>
 
 	* 38393: Completion/Unix/Command/_git: Fix typo in completion of
diff --git a/Completion/Debian/Command/_bts b/Completion/Debian/Command/_bts
index 941358b24..75085a9af 100644
--- a/Completion/Debian/Command/_bts
+++ b/Completion/Debian/Command/_bts
@@ -33,7 +33,7 @@ fi
 case "$words[1]" in
   (close|unmerge|notforwarded|noowner|reportspam)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     else
       _wanted sep expl 'separator' compadd -S ' ' , .
     fi
@@ -49,7 +49,7 @@ case "$words[1]" in
   ;;
   reopen)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     elif [[ CURRENT -eq 3 ]]; then
       _wanted submitter expl 'new submitter' compadd -- $DEBEMAIL
     else
@@ -58,7 +58,7 @@ case "$words[1]" in
   ;;
   retitle)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     elif [[ CURRENT -eq 3 ]]; then
      _message -e submitter 'new title'
     else
@@ -67,7 +67,7 @@ case "$words[1]" in
   ;;
   reassign)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     elif [[ CURRENT -eq 3 ]]; then
      _wanted submitter expl 'new package' _deb_packages avail
     else
@@ -75,14 +75,14 @@ case "$words[1]" in
     fi
   ;;
   merge)
-    _message -e bugnum 'bug number'
+    _debbugs_bugnumber
     if [[ CURRENT -gt 2 ]]; then
      _wanted sep expl 'separator' compadd -S ' ' , .
     fi
   ;;
   tags#)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     elif [[ CURRENT -eq 3 ]]; then
       _wanted operator expl 'operator' compadd - '+' '-' '='
     elif [[ CURRENT -eq 4 ]]; then
@@ -104,7 +104,7 @@ case "$words[1]" in
   ;;
   severity)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     elif [[ CURRENT -eq 3 ]]; then
       _wanted severity expl 'severity' \
 	  compadd wishlist minor normal serious important critical grave
@@ -114,7 +114,7 @@ case "$words[1]" in
   ;;
   forwarded)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     elif [[ CURRENT -eq 3 ]]; then
      _wanted upstream expl 'upstream email' _email_addresses -c
     else
@@ -123,7 +123,7 @@ case "$words[1]" in
   ;;
   (clone)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     elif [[ CURRENT -eq 3 || -prefix [-] ]]; then
      _wanted newid expl 'new ID' compadd -- -{1..9}
     else
@@ -132,17 +132,17 @@ case "$words[1]" in
   ;;
   (submitter)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     else
      _alternative \
-       'bugnum:bug number:' \
+       'bugnum:bug number:_debbugs_bugnumber' \
        'email:email address:_email_addresses -c' \
        'bang:bang:compadd \!'
     fi
   ;;
   (owner|subscribe|unsubscribe)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     elif [[ CURRENT -eq 3 ]]; then
       _alternative \
         'email:email address:_email_addresses -c' \
@@ -153,7 +153,7 @@ case "$words[1]" in
   ;;
   (found|notfound|fixed|notfixed)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     elif [[ CURRENT -eq 3 ]]; then
       _message -e version 'version'
     else
@@ -162,12 +162,12 @@ case "$words[1]" in
   ;;
   (block|unblock)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     elif [[ CURRENT -eq 3 ]]; then
       _wanted prep expl 'preposition' compadd by with
     else
      _alternative \
-       'bugnum:bug number:' \
+       'bugnum:bug number:_debbugs_bugnumber' \
        'separator:separator:compadd -S " " , .'
     fi
   ;;
@@ -180,7 +180,7 @@ case "$words[1]" in
   ;;
   (usertags#)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     elif [[ CURRENT -eq 3 ]]; then
       _wanted operator expl 'operator' compadd - '+' '-' '='
     elif [[ CURRENT -eq 4 ]]; then
@@ -211,7 +211,7 @@ case "$words[1]" in
   ;;
   (claim|unclaim)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     elif [[ CURRENT -eq 3 ]]; then
       _alternative \
         'email:email address:_email_addresses -c' \
@@ -222,7 +222,7 @@ case "$words[1]" in
   ;;
   (affects)
     if [[ CURRENT -eq 2 ]]; then
-      _message -e bugnum 'bug number'
+      _debbugs_bugnumber
     elif [[ CURRENT -eq 3 ]]; then
       _wanted operator expl 'operator' compadd - '+' '-' '='
     else
diff --git a/Completion/Debian/Command/_bug b/Completion/Debian/Command/_bug
index 99118114e..2dc14d488 100644
--- a/Completion/Debian/Command/_bug
+++ b/Completion/Debian/Command/_bug
@@ -103,5 +103,6 @@ case "$service" in
       '(-v --version)'{-v,--version}'[show version]' \
       "$_rb_commonargs[@]" \
       '*:a package name or bug numbers:_deb_packages avail'
+    # TODO: could call _debbugs_bugnumber here.
   ;;
 esac
diff --git a/Completion/Debian/Type/_debbugs_bugnumber b/Completion/Debian/Type/_debbugs_bugnumber
new file mode 100644
index 000000000..2c10998ac
--- /dev/null
+++ b/Completion/Debian/Type/_debbugs_bugnumber
@@ -0,0 +1,4 @@
+#autoload
+# TODO: use _describe with some basic metadata (e.g., bug title/package/version)
+[[ $PREFIX$SUFFIX == [0-9]# ]] &&
+_wanted -x bugnum expl 'bug number' compadd ~/.devscripts_cache/bts/<->.(html|mbox)(N:t:r)