summary refs log tree commit diff
diff options
context:
space:
mode:
authordana <dana@dana.is>2022-04-26 21:54:29 -0500
committerdana <dana@dana.is>2022-04-26 21:54:29 -0500
commitf59025f8490cc349e73f8d6c088391046115bb92 (patch)
treea8349520f62e83c92855c44e33a8e229fd245caa
parentc55a1f4bc2c54de2b1e2b24a36cbc0b5c0850a73 (diff)
downloadzsh-f59025f8490cc349e73f8d6c088391046115bb92.tar.gz
zsh-f59025f8490cc349e73f8d6c088391046115bb92.tar.xz
zsh-f59025f8490cc349e73f8d6c088391046115bb92.zip
unposted: Fix util-linux variant detection in _getopt
This had been broken all along for the actual util-linux getopt; i think the
'enhanced' text comes from the original author's version, which Homebrew was
still using when the function was written
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Unix/Command/_getopt7
2 files changed, 7 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3646486c2..8ff17f179 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2022-04-26  dana  <dana@dana.is>
 
+	* unposted: Completion/Unix/Command/_getopt: Fix util-linux
+	variant detection
+
 	* unposted: NEWS: Adjust dedication wording
 
 2022-04-26  Jun-ichi Takimoto  <takimoto-j@kba.biglobe.ne.jp>
diff --git a/Completion/Unix/Command/_getopt b/Completion/Unix/Command/_getopt
index 3359818b5..a8b0f6fc9 100644
--- a/Completion/Unix/Command/_getopt
+++ b/Completion/Unix/Command/_getopt
@@ -2,9 +2,10 @@
 
 local -a args aopts
 
-# Note: BusyBox getopt is borrowed straight from util-linux, so they're
-# basically identical
-if _pick_variant busybox=BusyBox util-linux='getopt*enhanced' unix --version; then
+# @todo BusyBox getopt is borrowed straight from util-linux, so they're nearly
+# identical, but not quite: BusyBox doesn't have -h and -V and often doesn't
+# support long options. So possibly this could be more accurate
+if _pick_variant busybox=BusyBox util-linux='(enhanced|util-linux)' unix --version; then
   args=(
     '(-a --alternative)'{-a,--alternative}'[allow long options with single -]'
     '(: -)'{-h,--help}'[display help information]'