From f6a1bc1489285d94e5685d9734130a6b12dfeba1 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sun, 3 Jun 2018 14:53:13 -0500 Subject: [PATCH] Fix unzip completions for non Info-ZIP versions macOS and (AFAICT) most Linux distributions ship with the Info-ZIP version of unzip, which has the `unzip -h` flag; but other implementations of unzip do not necessarily have it (i.e. FreeBSD). `unzip` under FreeBSD does not support `unzip -h`. Under both Linux and FreeBSD, `unzip -v` presents the list of options, though. Using this instead of `unzip -h` to detect the Debian-patched version of the Info-ZIP unzip program. --- share/completions/unzip.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/completions/unzip.fish b/share/completions/unzip.fish index be45e3fef..1c87aceed 100644 --- a/share/completions/unzip.fish +++ b/share/completions/unzip.fish @@ -25,7 +25,7 @@ complete -c unzip -s K -d "keep setuid/setgid/tacky permissions" complete -c unzip -s M -d "pipe through `more` pager" # Debian version of unzip -if unzip -h | string match -eq Debian +if unzip -v 2>/dev/null | string match -eq Debian # the first non-switch argument should be the zipfile complete -c unzip -n '__fish_is_first_token' -xa '(__fish_complete_suffix .zip)'