Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] _bts: Complete debbugs bug numbers from `bts cache`.
- X-seq: zsh-workers 38399
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] _bts: Complete debbugs bug numbers from `bts cache`.
- Date: Wed, 4 May 2016 06:03:37 +0000
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
---
Completion/Debian/Command/_bts | 36 +++++++++++++++----------------
Completion/Debian/Command/_bug | 1 +
Completion/Debian/Type/_debbugs_bugnumber | 4 ++++
3 files changed, 23 insertions(+), 18 deletions(-)
create mode 100644 Completion/Debian/Type/_debbugs_bugnumber
diff --git a/Completion/Debian/Command/_bts b/Completion/Debian/Command/_bts
index 941358b..75085a9 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 9911811..2dc14d4 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 0000000..2c10998
--- /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)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author