Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Fix pbuilder's --distribution,--architecture completion.
- X-seq: zsh-workers 41474
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] Fix pbuilder's --distribution,--architecture completion.
- Date: Sun, 30 Jul 2017 17:37:29 +0000
- Cc: Mattia Rizzolo <mattia@xxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=F2P8AL ICilZ/kSPuA3Qq6h9ieRKftO3gHIDWUNyVez0=; b=pwbhqn+KAnggVJC4erJrVx U4Jy/Tfd4y/QKBmdBv0pacFNNel5Wq65TKz5BlGi1RTQfF1XNfVjQc964gmcyJlW N7ZX7TbwPGHpaeuenH7kflZsSF+BNFjvLm+l0K1sSsdaqAZMeAdCTB39ocUlyuQX J4Q6C83CiEjwIZQQXRHHpR/iBEAAzAb20+upg3lK3Jl2vFpOravLf/Ajpeyn8nm+ QyR+uyE+IjbbCD/GzhrIJwh5q+dB876CcnAYBnFeVklHe01ao4xa336vfvvJ4VV6 IONY+s3T7G+Vjc1f7AlG9SORZ9YU5zEeNb3tHJWkroTC6qRpF19l8g99b8hdZ9Fg ==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=F2P8AL ICilZ/kSPuA3Qq6h9ieRKftO3gHIDWUNyVez0=; b=OENRSeCHUOAmjusuQZAu/h cvwhoAma64yFWxemlMPlldumaH4PZC/Cc9u1Y/LFIRJGn8x0seVGDwLAhUd9jq7k I217YrbnF668LsY6WXo+DAO+4utHa9E/L7MxSZJ9yWfV0Srwi0ExFB03RZARWwzk HlYBCZIaArOWYTl6cxkU1FT1H/kt9Q5gJOIaXpb+Yy+xI0wy7rVQFOgljQ9gG0JJ 8GsFhGQtpE0DrnCpijIMh8BHK5ZrZnQyYlS/qo0+CEa/q5pVPbtnlIgcwv1po04v cIn4EVWAZTAqk22R9NDDbxicGcJIsD32poa8dwwbGLIeMdwllnQgkaRh9CY/uN3g ==
- 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/_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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author