summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.eti.br>2018-11-17 12:43:47 -0200
committerGabriel F. T. Gomes <gabriel@inconstante.eti.br>2018-11-17 13:10:54 -0200
commit77ed63519ff5631475a496af1c536d8484a613f6 (patch)
treea7bc319d17d5506eaf9e1903965dec27077c05c1
parentb544fe206a8e66ac1d57c05543304577fc65713a (diff)
downloadbash-completion-77ed63519ff5631475a496af1c536d8484a613f6.tar.gz
Add support for tar zstd completion (bug #913949)
This patch adds support for completing tar commands with zstd compression extensions (`.zst' and `.tzst'). Support for the compression itself is available since tar-1.30+dfsg-3 [1]. Thanks to Adam Borowski for reporting. [1] https://tracker.debian.org/news/1003756/accepted-tar-130dfsg-3-source-amd64-into-unstable/
-rw-r--r--debian/changelog1
-rw-r--r--debian/patches/12-tar-support-completions-for-zstd-compression.patch57
-rw-r--r--debian/patches/series1
3 files changed, 59 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 2c0fd9ea..3ab99c54 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ bash-completion (1:2.8-4) UNRELEASED; urgency=medium
* Allow `+' in (ssh/know_hosts) hostnames. (Closes: #848125)
* Add completions for OpenRC rc-service. (Closes: #865548)
+ * Add zstd completions for tar. (Closes: #913949)
-- Gabriel F. T. Gomes <gabriel@inconstante.eti.br> Sat, 10 Nov 2018 18:07:37 -0200
diff --git a/debian/patches/12-tar-support-completions-for-zstd-compression.patch b/debian/patches/12-tar-support-completions-for-zstd-compression.patch
new file mode 100644
index 00000000..d5055bc4
--- /dev/null
+++ b/debian/patches/12-tar-support-completions-for-zstd-compression.patch
@@ -0,0 +1,57 @@
+From: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
+Subject: tar: Support completions for zstd compression extensions
+Origin: vendor, https://bugs.debian.org/913949
+Bug-Debian: https://bugs.debian.org/913949
+Forwarded: yes, https://github.com/scop/bash-completion/pull/255
+
+Since upstream version 1.30.90, GNU tar supports zstd compression [1].
+According to the same NEWS entry, the extensions for archive names are
+`.zst' and `.tzst'. This patch adds support for completing these
+extensions.
+
+This is the output of the completions after the patch:
+
+ $ ls
+ bla.gem.gz bla.invalid.gz bla.spkg.gz bla.tar.gz bla.tgz
+ bla.gem.zst bla.invalid.zst bla.spkg.zst bla.tar.zst bla.tzst
+ $ tar -tf bla.
+ bla.gem.gz bla.spkg.gz bla.tar.gz bla.tgz
+ bla.gem.zst bla.spkg.zst bla.tar.zst bla.tzst
+ $ tar -ztf bla.
+ bla.gem.gz bla.spkg.gz bla.tar.gz bla.tgz
+
+Since tar does not provide a one-character shortcut for zstd
+compression, I wasn't able to filter only .zst files:
+
+ $ tar --zstd -tf bla.[TAB]
+ bla.gem.gz bla.spkg.gz bla.tar.gz bla.tgz
+ bla.gem.zst bla.spkg.zst bla.tar.zst bla.tzst
+
+The request came from Adam Borowski via a Debian bug [2].
+
+[1] http://git.savannah.gnu.org/cgit/tar.git/commit/NEWS?id=688924d2a8e1cefb2a5c6c5e562391b5bcfadcb2
+
+[2] https://bugs.debian.org/913949
+---
+ completions/tar | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/completions/tar b/completions/tar
+index 49265ad4..4f20d2e2 100644
+--- a/completions/tar
++++ b/completions/tar
+@@ -433,9 +433,9 @@ __tar_cleanup_prev()
+
+ __tar_detect_ext()
+ {
+- local tars='@(@(tar|gem|spkg)?(.@(Z|[bgx]z|bz2|lz?(ma|o)))|t@([abglx]z|b?(z)2))'
++ local tars='@(@(tar|gem|spkg)?(.@(Z|[bgx]z|bz2|lz?(ma|o)|zst))|t@([abglx]z|b?(z)2|zst))'
+ ext="$tars"
+- regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[bgx]z\|bz2\|lz\(ma\|o\)\?\)\)\?\|t\([abglx]z\|bz\?2\)\)'
++ regex='\(\(tar\|gem\|spkg\)\(\.\(Z\|[bgx]z\|bz2\|lz\(ma\|o\)\?\|zst\)\)\?\|t\([abglx]z\|bz\?2\)\)'
+
+ case "$tar_mode_arg" in
+ --*)
+--
+2.19.1
+
diff --git a/debian/patches/series b/debian/patches/series
index e9884590..3717b5f7 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,4 +10,5 @@
09-backport-to-fix-wildcard-completion.patch
10-reimplement-known-hosts-file-parsing.patch
11-add-completions-for-openrc-rc-service.patch
+12-tar-support-completions-for-zstd-compression.patch
99-use-install-data-hook.patch