summaryrefslogtreecommitdiffstats
path: root/Completion/Unix
diff options
context:
space:
mode:
authordana <dana@dana.is>2018-01-04 11:48:02 -0600
committerOliver Kiddle <opk@zsh.org>2018-01-05 15:29:17 +0100
commitae059841b0791195fbae04bafc2acc73058b48fc (patch)
treeba2e709e60b51bd2f28f98affd40812a5cd63c75 /Completion/Unix
parent42221: update enscript completion for GNU enscript 1.6.6 (diff)
downloadzsh-ae059841b0791195fbae04bafc2acc73058b48fc.tar
zsh-ae059841b0791195fbae04bafc2acc73058b48fc.tar.gz
zsh-ae059841b0791195fbae04bafc2acc73058b48fc.tar.bz2
zsh-ae059841b0791195fbae04bafc2acc73058b48fc.tar.lz
zsh-ae059841b0791195fbae04bafc2acc73058b48fc.tar.xz
zsh-ae059841b0791195fbae04bafc2acc73058b48fc.tar.zst
zsh-ae059841b0791195fbae04bafc2acc73058b48fc.zip
42223: new completions for sublime text and some basic Unix utilities
Diffstat (limited to 'Completion/Unix')
-rw-r--r--Completion/Unix/Command/_fold24
-rw-r--r--Completion/Unix/Command/_getopt28
-rw-r--r--Completion/Unix/Command/_install111
-rw-r--r--Completion/Unix/Command/_mktemp43
4 files changed, 206 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_fold b/Completion/Unix/Command/_fold
new file mode 100644
index 000000000..1a3ef8b55
--- /dev/null
+++ b/Completion/Unix/Command/_fold
@@ -0,0 +1,24 @@
+#compdef fold gfold
+
+local variant
+local -a args
+
+_pick_variant -r variant busybox=BusyBox gnu='Free Soft' unix --version
+
+args=(
+ '(-b --bytes)'{-b,--bytes}'[count bytes rather than columns]'
+ '(: -)--help[display help information]'
+ '(-s --spaces)'{-s,--spaces}'[fold on whitespace]'
+ '(-w --width)'{-w+,--width=}'[specify line width]:line width (columns or bytes)'
+ '(: -)--version[display version information]'
+ '*: :_files'
+)
+
+# Non-GNU variants don't support long options (except BusyBox's --help)
+if [[ $variant == *busybox* ]]; then # See also: _busybox
+ args=( ${args:#((#s)|*\))(\*|)--^help*} )
+elif [[ $variant != gnu ]]; then
+ args=( ${args:#((#s)|*\))(\*|)--*} )
+fi
+
+_arguments -s -S : $args
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
diff --git a/Completion/Unix/Command/_install b/Completion/Unix/Command/_install
new file mode 100644
index 000000000..25d9dfcaa
--- /dev/null
+++ b/Completion/Unix/Command/_install
@@ -0,0 +1,111 @@
+#compdef install ginstall
+
+local curcontext="$curcontext" lx ret=1
+local -a line state state_descr common_args args tmp
+local -A opt_args val_args
+
+# These are *almost* common — non-GNU variants need to remove the long options
+common_args=(
+ '(--backup)-b[create backups of destination files]'
+ '(-C -c --compare)'{-C,--compare}'[copy files; do nothing if identical destination file exists]'
+ '(-C -c --compare)-c[copy files (default)]'
+ '(-d --directory)'{-d,--directory}'[create directories]'
+ '(-g --group)'{-g+,--group=}'[specify destination file group]: :_groups'
+ '(-m --mode)'{-m+,--mode=}'[specify destination file mode]: :_modes'
+ '(-o --owner)'{-o+,--owner=}'[specify destination file owner]: :_users'
+ '(-p --preserve-timestamps)'{-p,--preserve-timestamps}'[preserve modification times]'
+ '(-s --strip)'{-s,--strip}'[strip binaries]'
+ '(-v --verbose)'{-v,--verbose}'[output verbosely]'
+ '*: :_files'
+)
+
+if _pick_variant gnu='Free Soft' unix --version; then
+ # Hide Linux-specific options on non-Linux platforms
+ [[ $OSTYPE == linux* ]] || lx='!'
+ args+=(
+ $common_args
+ '(-b --backup)--backup=[create backup; optionally specify method]:: :->controls'
+ "${lx}--context=[like -Z, or specify SELinux security context to set]::SELinux security context"
+ '-D[create all leading destination path components]'
+ '(: -)--help[display help information]'
+ "${lx}--preserve-context[preserve SELinux security context]"
+ '--strip-program=[specify program used to strip binaries]:strip program:_files'
+ '(-S --suffix)'{-S+,--suffix=}'[specify backup suffix]:backup suffix'
+ '(-t --target-directory)'{-t+,--target-directory=}'[copy source to specified directory]: :_directories'
+ '(-T --no-target-directory)'{-T,--no-target-directory}'[treat destination as regular file]'
+ '(: -)--version[display version information]'
+ "${lx}-Z[set SELinux security context on destination files to default type]"
+ )
+
+else
+ args+=(
+ ${common_args##((#s)|*\))(\*|)--*}
+ '-B+[specify backup suffix for -b]:backup suffix'
+ '-f+[specify destination file flags]: :_flags'
+ )
+ [[ $OSTYPE == dragonfly* ]] && args+=(
+ '!-D+[no effect (compatibility with NetBSD)]: :_directories'
+ '-L+[use user/group database files from specified directory]: :_directories'
+ '-l[fall back to system files if user/group not found in -L directory]'
+ )
+ [[ $OSTYPE == netbsd* ]] && {
+ args+=(
+ '-a+[specify shell command to run on files after install]:shell command'
+ '-r[use temporary files to perform safe copy]'
+ '-S+[specify arguments to pass to strip program]:arguments to strip program'