summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_cp2
-rw-r--r--Completion/Unix/Command/_expand16
-rw-r--r--Completion/Unix/Command/_mv42
-rw-r--r--Completion/Unix/Command/_numfmt24
-rw-r--r--Completion/Unix/Command/_seq28
-rw-r--r--Completion/Unix/Command/_split64
-rw-r--r--Completion/Unix/Command/_stdbuf30
-rw-r--r--Completion/Unix/Command/_timeout19
-rw-r--r--Completion/Unix/Command/_unexpand24
9 files changed, 236 insertions, 13 deletions
diff --git a/Completion/Unix/Command/_cp b/Completion/Unix/Command/_cp
index 5c3f37983..88750b330 100644
--- a/Completion/Unix/Command/_cp
+++ b/Completion/Unix/Command/_cp
@@ -55,7 +55,7 @@ else
     'netbsd*' "-N[don't copy file flags]" \
     '(darwin|dragonfly|freebsd|netbsd)*' '-a[archive mode, same as -RpP]' \
     '(dragonfly|freebsd)*' '-l[link files instead of copying]' \
-    '(darwin|dragonfly|freebsd|netbsd)*' '-v[show file names as they are copied]' \
+    '(darwin|dragonfly|*bsd)*' '-v[show file names as they are copied]' \
     'darwin*' "-X[don't copy extended attributes or resource forks]" \
     '(dragonfly|freebsd)*' "-x[don't traverse file systems]" \
     'freebsd<10->.*' '-s[make symbolic links instead of copies of non-directories]'
diff --git a/Completion/Unix/Command/_expand b/Completion/Unix/Command/_expand
new file mode 100644
index 000000000..3f297dce2
--- /dev/null
+++ b/Completion/Unix/Command/_expand
@@ -0,0 +1,16 @@
+#compdef expand gexpand
+
+local -a args
+
+if _pick_variant gnu=GNU unix --version; then
+  args=(
+    '(-i --initial --help)'{-i,--initial}"[don't convert tabs after non blanks]"
+    '(-t --tabs --version)'{-t+,--tabs=}'[specify tab width]:list of tab positions'
+    '(* -)--help[display usage information]'
+    '(* -)--version[output version information]'
+  )
+else
+  args=( -A "-*" '(-t --tabs)'{-t+,--tabs=}'[specify tab width]:list of tab positions' )
+fi
+
+_arguments -s -S "$args[@]" '*:file:_files'
diff --git a/Completion/Unix/Command/_mv b/Completion/Unix/Command/_mv
new file mode 100644
index 000000000..3592efee6
--- /dev/null
+++ b/Completion/Unix/Command/_mv
@@ -0,0 +1,42 @@
+#compdef mv gmv
+
+local args
+if _pick_variant gnu=GNU unix --version; then
+  args=(
+    '(-b --backup -n --no-clobber)--backup=[make a backup of each existing destination file]: : _values "backup type"
+      {none,off}"[never make backups]"
+      {numbered,t}"[make numbered backups]"
+      {existing,nil}"[numbered backups, if they already exist]"
+      {simple,never}"[always make simple backups]"'
+    '(-b --backup -n --no-clobber)-b[make a backup of each existing destination file]'
+    '(-f --force -i --interactive -n --no-clobber)'{-f,--force}"[don't prompt before overwriting]"
+    '(-f --force -i --interactive -n --no-clobber)'{-i,--interactive}'[prompt before overwriting existing file]'
+    '--strip-trailing-slashes[remove any trailing slashes from each source argument]'
+    '(-S --suffix)'{-S+,--suffix=}'[specify the backup suffix]:backup suffix [~]'
+    '(-t --target-directory)'{-t+,--target-directory=}'[move all source arguments into specified directory]:directory:_directories'
+    '(-T --no-target-directory)'{-T,--no-target-directory}'[treat final argument as a normal file]'
+    '(-u --update)'{-u,--update}'[move only when destination file is older or missing]'
+    '(-v --verbose)'{-v,--verbose}'[show file names after they are moved]'
+    '(- *)--help[display usage information]'
+    '(- *)--version[display version information]'
+  )
+  [[ $OSTYPE = linux* ]] && args+=(
+    '(-Z --context)'{-Z,--context}'[set SELinux security context of destination file to default type]'
+  )
+else
+  local pattern arg
+  args=(
+    "(-i -n)-f[don't prompt before overwriting]"
+    '(-f -n)-i[prompt before overwriting existing file]'
+  )
+  for pattern arg in \
+    '(darwin|dragonfly|freebsd)*' "(-f -i)-n[don't overwrite existing file]" \
+    '(darwin|dragonfly|*bsd)*' '-v[show file names after they are moved]' \
+    '(dragonfly|freebsd)*' "-h[if target is a symlink to a directory, don't follow it]"
+  do
+    [[ $OSTYPE = $~pattern ]] && args+=( $arg )
+  done
+fi
+
+_arguments -s -S $args \
+  '*:file:_files'
diff --git a/Completion/Unix/Command/_numfmt b/Completion/Unix/Command/_numfmt
new file mode 100644
index 000000000..999c412a1
--- /dev/null
+++ b/Completion/Unix/Command/_numfmt
@@ -0,0 +1,24 @@
+#compdef numfmt gnumfmt
+
+local units="((auto\:1K\ =\ 1000,\ 1Ki\ =\ 1024 si\:1K\ =\ 1000 iec\:1K\ =\ 1024 iec-i\:1Ki\ =\ 1024))"
+
+_arguments -S \
+  '(H)--debug[print warnings about invalid input]' \
+  '(H -z --zero-terminated -d --delimiter)'{-d+,--delimiter=}'[use specified field delimiter instead of whitespace]:delimiter' \
+  '(H)--field=[replace numbers in specified input fields]:fields [1]' \
+  '(H)--format=[use printf style floating-point format]:format' \
+  "(H)--from=[auto-scale input numbers to specified units]:unit [none]:$units" \
+  '(H)--from-unit=[specify the input unit size]:unit size [1]' \
+  '(H)--grouping[use locale-defined digit grouping e.g. 1,000,000]' \
+  '(H)--header=-[print (without converting) initial header lines]::header lines [1]' \
+  '(H)--invalid=[specify failure mode for invalid numbers]:mode [abort]:(abort fail warn ignore)' \
+  '(H)--padding=[pad the output to specified width]:width; positive - right-align; negative - left-align' \
+  '(H)--round=[use specified method for rounding when scaling]:method [from-zero]:(up down from-zero towards-zero nearest)' \
+  '(H)--suffix=[add suffix to output numbers and accept optional suffix in input numbers]:suffix' \
+  "(H)--to=[auto-scale output numbers to specified unit]:unit:$units" \
+  '(H)--to-unit=[specify output unit size]:unit size [1]' \
+  '(H -z --zero-terminated -d --delimiter)'{-z,--zero-terminated}'[line delimiter is NUL, not newline]' \
+  '(H)*: :_guard "^-*" number' \
+  + 'H' \
+  '(- *)--help[display usage information]' \
+  '(- *)--version[display version information]'
diff --git a/Completion/Unix/Command/_seq b/Completion/Unix/Command/_seq
new file mode 100644
index 000000000..5b825675f
--- /dev/null
+++ b/Completion/Unix/Command/_seq
@@ -0,0 +1,28 @@
+#compdef seq gseq
+
+local variant args
+
+_pick_variant -r variant gnu=GNU $OSTYPE --version
+
+args=( ':: :_guard "^-[^0-9]*" '{first,step,last} )
+case $variant in
+  gnu)
+    args+=(
+      '(--help --version)'{-f+,--format=}'[use printf style floating-point format]:format'
+      '(--help --version -s --separator)'{-s+,--separator=}'[use specified separator for numbers]:separator [\n]'
+      '(--help --version -w --equal-width)'{-w,--equal-width}'[equalize width by padding with leading zeroes]'
+      '(- 1 2 3)--help[display usage information]'
+      '(- 1 2 3)--version[display version information]'
+     )
+  ;;
+  *)
+    args+=(
+      '-f+[use printf style floating-point format]:format'
+      '-s+[use specified separator for numbers]:separator [\n]'
+      '-t+[use specified string to terminate numbers]:string [\n]'
+      '-w[equalize width by padding with leading zeroes]'
+    )
+  ;;
+esac
+
+_arguments -s -A '-[^1-9]*' $args
diff --git a/Completion/Unix/Command/_split b/Completion/Unix/Command/_split
new file mode 100644
index 000000000..25b5aec2d
--- /dev/null
+++ b/Completion/Unix/Command/_split
@@ -0,0 +1,64 @@
+#compdef split gsplit
+
+local curcontext="$curcontext" variant ret=1
+local -A opt_args
+local -a state line args
+
+_pick_variant -r variant gnu=GNU $OSTYPE --version
+
+args=(
+  '-a+[generate suffixes of specified length]:length [2]' \
+  '(-l -p -n)-b+[put specified size in bytes in each output file]:size (bytes)' \
+  '(-b -p -n)-l+[put specified number of lines/records in each output file]:lines' \
+  '1:file:_files' \
+  '2: :_guard "^-*" "prefix [x]"'
+)
+
+case $variant in
+  gnu)
+    args=( -C
+      '(H -a --suffix-length)'{-a+,--suffix-length=}'[generate suffixes of specified length]:length [2]'
+      '(H)--additional-suffix=[append an additional suffix to file names]:suffix'
+      '(H -b --bytes -C --line-bytes -l --lines -n --number)'{-b+,--bytes=}'[put specified size in bytes in each output file]:size (bytes)'
+      '(H -b --bytes -C --line-bytes -l --lines -n --number)'{-C+,--line-bytes=}'[put whole lines/records up to size limit in each output file]:size (bytes)'
+      '(H --numeric-suffixes -x --hex-suffixes)-d[use numeric suffixes starting at 0]'
+      '(H -d -x --hex-suffixes)--numeric-suffixes=-[use numeric suffixes]::start value [0]'
+      '(H -d --numeric-suffixes --hex-suffixes)-x[use hex suffixes starting at 0]'
+      '(H -d --numeric-suffixes -x)--hex-suffixes=-[use hex suffixes]::start value [0]'
+      '(H -e --elide-empty-files)'{-e,--elide-empty-files}"[don't generate empty output files with '-n']"
+      '(H)--filter=[write to shell command; filename is in $FILE]:command:_cmdstring'
+      '(H -b --bytes -C --line-bytes -l --lines -n --number)'{-l+,--lines=}'[put specified number of lines/records in each output file]:lines'
+      '(H -b --bytes -C --line-bytes -l --lines -n --number)'{-n+,--number=}'[generate specified number of output files]:chunks:->chunks'
+      '(H -t --separator)'{-t+,--separator=}'[use specified record separator instead of newline]:separator'
+      '(H -u --unbuffered)'{-u,--unbuffered}"[immediately copy input to output with '-n r/...']"
+      '(H)--verbose[print a diagnostic just before each output file is opened]'
+      '(H)1:file:_files'
+      '(H)2: :_guard "^-*" "prefix [x]"'
+      + 'H'
+      '(- 1 2)--help[display usage information]'
+      '(- 1 2)--version[display version information]'
+    )
+  ;;
+  (free|net)bsd*)
+    args+=( '(-b -l -p)-n+[generate specified number of output files]:output files' )
+  ;|
+  freebsd*)
+    args+=(
+      '-d[use numeric suffixes]'
+      '(-b -l -n)-p+[split the file whenever a line matches specified pattern]:pattern'
+    )
+  ;;
+esac
+
+_arguments -s -S $args && ret=0
+
+if [[ $state = chunks ]]; then
+  if [[ ! -prefix *[0-9/]* ]]; then
+    _alternative 'modifiers: :_values -s/ "modifier" "l[don'\''t split lines/records]" "r[round robin distribution]"' \
+      'lines: :_guard "[0-9/]#" lines' && ret=0
+  else
+    _message -e lines lines
+  fi
+fi
+
+return ret
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
diff --git a/Completion/Unix/Command/_timeout b/Completion/Unix/Command/_timeout
new file mode 100644
index 000000000..0e6d057b3
--- /dev/null
+++ b/Completion/Unix/Command/_timeout
@@ -0,0 +1,19 @@
+#compdef timeout gtimeout
+
+local args
+
+if [[ $service = g* || $OSTYPE != *bsd* ]]; then
+  # GNU coreutils as opposed to Free/NetBSD implementation
+  args=(
+    '(- *)--help[display usage information]'
+    '(- *)--version[display version information]'
+  )
+fi
+
+_arguments -S -A "-" $args \
+  '--preserve-status[always exit with the same status as command even if it times out]' \
+  "--foreground[don't propagate timeout to the command children]" \
+  '(-s --signal)'{-s,--signal}'[specify the signal to send on timeout]:signal:_signals' \
+  '(-k --kill-after)'{-k,--kill-after}'[followup first signal with SIGKILL if command persists after specified time]:time:time' \
+  '1: :_guard "[0-9.]#([smhd]|)" duration' \
+  '*:::command:_normal'
diff --git a/Completion/Unix/Command/_unexpand b/Completion/Unix/Command/_unexpand
index c983c628f..d9793ea70 100644
--- a/Completion/Unix/Command/_unexpand
+++ b/Completion/Unix/Command/_unexpand
@@ -1,4 +1,4 @@
-#compdef unexpand
+#compdef unexpand gunexpand
 
 local all tabs ret=1
 local -a args
@@ -6,21 +6,21 @@ local -a args
 all="convert all whitespace, instead of just initial whitespace"
 tabs="use comma separated list of tab positions"
 args=( 
-    "(--all)-a[$all]"
-    "(--tabs)-t[$tabs]:tablist"
-    "*:file:_files"
+  "(--all)-a[$all]"
+  "(--tabs)-t+[$tabs]:tablist"
+  '*:file:_files'
 )
 
 if _pick_variant gnu="Free Soft" unix --version; then
-    args+=(
-        "(-a)--all[$all]"
-        "--first-only[convert only leading sequences of whitespace]"
-        "(-t)--tabs=[$tabs]:tablist"
-        "(* -)--help[display help message and exit]"
-        "(* -)--version[output version information and exit]"
-    )
+  args+=(
+    "(-a)--all[$all]"
+    '--first-only[convert only leading sequences of whitespace]'
+    "(-t)--tabs=[$tabs]:tablist"
+    '(* -)--help[display usage information]'
+    '(* -)--version[output version information]'
+  )
 fi
 
-_arguments "$args[@]" && ret=0
+_arguments -s -S "$args[@]" && ret=0
 
 return ret