about summary refs log tree commit diff
path: root/Completion/Unix/Command/_stdbuf
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2017-10-07 22:26:51 +0200
committerOliver Kiddle <opk@zsh.org>2017-10-07 22:26:51 +0200
commit69fcc22dc84e8411870ba8f2a4c876e223ad2a08 (patch)
tree1ccdeb6677938ae9f23ec0a55ed59f5045a26a56 /Completion/Unix/Command/_stdbuf
parente49aabc13a858c636146f6744ac25b3e741763ff (diff)
downloadzsh-69fcc22dc84e8411870ba8f2a4c876e223ad2a08.tar.gz
zsh-69fcc22dc84e8411870ba8f2a4c876e223ad2a08.tar.xz
zsh-69fcc22dc84e8411870ba8f2a4c876e223ad2a08.zip
41823: new completions for some GNU coreutils utilities
Diffstat (limited to 'Completion/Unix/Command/_stdbuf')
-rw-r--r--Completion/Unix/Command/_stdbuf30
1 files changed, 30 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_stdbuf b/Completion/Unix/Command/_stdbuf
new file mode 100644
index 000000000..3bce3d0a7
--- /dev/null
+++ b/Completion/Unix/Command/_stdbuf
@@ -0,0 +1,30 @@
+#compdef stdbuf
+
+local -a short long buf args
+local i opt gnu=0
+
+short=( -e -i -o )
+long=( --error --output --input )
+buf=( err in out )
+
+opt='[set initial buffering for std${buf[i]}]:mode or size:((0\:unbuffered L\:line\ buffered'
+if _pick_variant gnu=GNU freebsd --version; then
+  gnu=1
+  args=(
+    '(- *)--help[display usage information]'
+    '(- *)--version[display version information]'
+  )
+else
+  opt+=' B\:fully\ buffered'
+fi
+opt+='))'
+
+for ((i=1;i<=3;i++)); do
+  args+=( "(${long[i]})${short[i]}+${(e)opt}" )
+  (( gnu )) && args+=(
+    "(${short[i]})${long[i]}=${(e)opt}"
+  )
+done
+(( CURRENT > 2 )) && args+=( '*::command:_normal' )
+
+_arguments -s -S $args