From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Cc: Mattia Rizzolo <mattia@debian.org>
Subject: [PATCH] Fix pbuilder's --distribution,--architecture completion.
Date: Sun, 30 Jul 2017 17:37:29 +0000 [thread overview]
Message-ID: <20170730173729.26850-1-danielsh@tarpaulin.shahaf.local2> (raw)
---
Completion/Debian/Command/_pbuilder | 4 ++--
Completion/Debian/Type/_deb_codenames | 12 ++++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
create mode 100644 Completion/Debian/Type/_deb_codenames
diff --git a/Completion/Debian/Command/_pbuilder b/Completion/Debian/Command/_pbuilder
index 9322d036a..6377538b2 100644
--- a/Completion/Debian/Command/_pbuilder
+++ b/Completion/Debian/Command/_pbuilder
@@ -14,8 +14,8 @@ else
'--buildresult:location:_files -/' \
'--mirror:URL:_urls' \
'--othermirror:URL:_urls' \
- '--distribution:suite:(breezy dapper edgy etch feisty gutsy hardy hoary intrepid jaunty jessie karmic lenny lucid potato sarge sid squeeze warty woody' \
- '--architecture:architecture:i_deb_architectures' \
+ '--distribution:codename:_deb_codenames' \
+ '--architecture:architecture:_deb_architectures' \
'--components:component:(main contrib non-free)' \
'--override-config' \
'--hookdir:location:_files -/' \
diff --git a/Completion/Debian/Type/_deb_codenames b/Completion/Debian/Type/_deb_codenames
new file mode 100644
index 000000000..feea8b49a
--- /dev/null
+++ b/Completion/Debian/Type/_deb_codenames
@@ -0,0 +1,12 @@
+#autoload
+
+local distro codenames ret=1
+
+for distro in /usr/share/distro-info/*.csv(N); do
+ # TODO: magic number "6"
+ codenames=( ${(f)"$(<$distro tail -n6 | cut -d, -f3,1)"} )
+ codenames=( ${codenames/(#b)(*),(*)/${match[2]}:${match[1]}} )
+ _describe -V -t codename-${distro:t:r} "${distro:t:r} codenames" codenames && ret=0
+done
+
+return ret
This function uses distro-info-data because I figured a hardcoded list of
codenames would bitrot sooner or later. The hardcoded "6" is because
EOL dates are not available in the Debian stable version of distro-info-data.
reply other threads:[~2017-07-30 17:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170730173729.26850-1-danielsh@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=mattia@debian.org \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).