summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2017-07-30 17:37:29 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2017-08-01 01:08:01 +0000
commit06e70fb42d68f8b3871718a2439e53c875de5bc7 (patch)
tree950f9ae96ba07ad7803e32439f0f314f5b4e2dd3
parentd17f9d32f0e65c3956193be06130dd7cec275c9a (diff)
downloadzsh-06e70fb42d68f8b3871718a2439e53c875de5bc7.tar.gz
zsh-06e70fb42d68f8b3871718a2439e53c875de5bc7.tar.xz
zsh-06e70fb42d68f8b3871718a2439e53c875de5bc7.zip
41474: Fix pbuilder's --distribution,--architecture completion.
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Debian/Command/_pbuilder4
-rw-r--r--Completion/Debian/Type/_deb_codenames12
3 files changed, 20 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c9764b70a..687497d27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-01  Daniel Shahaf  <d.s@daniel.shahaf.name>
+
+	* 41474: Completion/Debian/Command/_pbuilder,
+	Completion/Debian/Type/_deb_codenames: Fix pbuilder's
+	--distribution,--architecture completion.
+
 2017-07-31  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* unposted: Config/version.mk: test release 5.3.1-test-2.
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