summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_getopt
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2018-04-07 15:12:57 +0200
committerAxel Beckert <abe@deuxchevaux.org>2018-04-07 15:12:57 +0200
commit6e1ab9aa550695ee7e3d467b4173c0b83ba7f759 (patch)
tree8fb7faa4364a7cbf1cba48296a5f537e13f2a8d9 /Completion/Unix/Command/_getopt
parent5ad56a41f1ee2e61abca079f5ea8909f895ac2dd (diff)
parentf027f1d6e876708bc75d4217e1ca26898658d8d3 (diff)
downloadzsh-6e1ab9aa550695ee7e3d467b4173c0b83ba7f759.tar.gz
zsh-6e1ab9aa550695ee7e3d467b4173c0b83ba7f759.zip
Merge tag 'zsh-5.4.2-test-2' / 'upstream' branch into 'debian' branch
Test version 2 prior to zsh 5.5.
Diffstat (limited to 'Completion/Unix/Command/_getopt')
-rw-r--r--Completion/Unix/Command/_getopt28
1 files changed, 28 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_getopt b/Completion/Unix/Command/_getopt
new file mode 100644
index 000000000..3359818b5
--- /dev/null
+++ b/Completion/Unix/Command/_getopt
@@ -0,0 +1,28 @@
+#compdef getopt ggetopt
+
+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
+ args=(
+ '(-a --alternative)'{-a,--alternative}'[allow long options with single -]'
+ '(: -)'{-h,--help}'[display help information]'
+ '*'{-l+,--longoptions=}'[specify long options]:long options'
+ '(-n --name)'{-n+,--name=}'[specify program name]:program name'
+ '(1 -o --options)'{-o+,--options=}'[specify short options]:short options'
+ '(-q --quiet)'{-q,--quiet}'[suppress getopt(3) error messages]'
+ '(-Q --quiet-output)'{-Q,--quiet-output}'[suppress normal output]'
+ '(-s --shell)'{-s+,--shell=}'[specify shell quoting conventions]:shell:(bash csh tcsh sh)'
+ '(: -)'{-T,--test}'[test for enhanced getopt]'
+ '(-u --unquoted)'{-u,--unquoted}'[do not quote output]'
+ '(: -)'{-V,--version}'[display version information]'
+ '(-o --options)1: :_guard "^-*" "short options"'
+ '*:argument'
+ )
+ [[ -n $POSIXLY_CORRECT ]] && aopts+=( -A '-*' )
+else
+ args=( '1:short options' '*:argument' )
+fi
+
+_arguments -s -S $aopts : $args