about summary refs log tree commit diff
path: root/Completion/Zsh
diff options
context:
space:
mode:
authorPaul Ackersviller <packersv@users.sourceforge.net>2007-05-03 02:49:38 +0000
committerPaul Ackersviller <packersv@users.sourceforge.net>2007-05-03 02:49:38 +0000
commit26785dfe6b5e36e520934585f91aaa44704bba75 (patch)
tree40f0c08763ae2cf9acff5fd2d578fb5ce197f7c8 /Completion/Zsh
parent4bf9b6583911e3c2163dd6317e32e2a0a76dc0ee (diff)
downloadzsh-26785dfe6b5e36e520934585f91aaa44704bba75.tar.gz
zsh-26785dfe6b5e36e520934585f91aaa44704bba75.tar.xz
zsh-26785dfe6b5e36e520934585f91aaa44704bba75.zip
Merge from trunk of files in 21315.
Diffstat (limited to 'Completion/Zsh')
-rw-r--r--Completion/Zsh/Command/_print32
-rw-r--r--Completion/Zsh/Command/_read21
-rw-r--r--Completion/Zsh/Command/_unhash14
-rw-r--r--Completion/Zsh/Type/_arrays5
-rw-r--r--Completion/Zsh/Type/_file_descriptors29
-rw-r--r--Completion/Zsh/Type/_functions5
-rw-r--r--Completion/Zsh/Type/_jobs_bg3
-rw-r--r--Completion/Zsh/Type/_jobs_fg3
-rw-r--r--Completion/Zsh/Type/_limits5
-rw-r--r--Completion/Zsh/Type/_options8
-rw-r--r--Completion/Zsh/Type/_options_set10
-rw-r--r--Completion/Zsh/Type/_options_unset10
12 files changed, 145 insertions, 0 deletions
diff --git a/Completion/Zsh/Command/_print b/Completion/Zsh/Command/_print
new file mode 100644
index 000000000..af0501b7a
--- /dev/null
+++ b/Completion/Zsh/Command/_print
@@ -0,0 +1,32 @@
+#compdef print
+
+local state expl line eflag pflag
+
+# -e flag available only after -R 
+eflag="${words[1,CURRENT-1][(r)-*R*]:+-e[enable escapes]}"
+
+# -p flag only relevant if we have a coprocess
+(:>&p) 2>/dev/null &&
+  pflag='(-s -u -z)-p[print arguments to input of coprocess]'
+
+_arguments -C -s -A "-*" -S \
+  '(-f)-r[ignore escape conventions of echo]' \
+  '(-r -b -f -m -s -l -N -o -O -i -c -u -p -z -D -P)-R[emulate BSD echo (no escapes, -n & -e flags only)]' \
+  '-b[recognise bindkey escape sequences]' \
+  '-m[remove arguments matching specified pattern]' \
+  '(-r -n -R -l -N -c)-f+[print arguments as for the printf builtin]:format' \
+  '(-u -p -z)-s[place results in the history list]' \
+  '(-c -f)-n[do not add a newline to the result]' \
+  '(-N -c -f)-l[print arguments separated by newlines]' \
+  '(-n -l -c -f)-N[print arguments separated and terminated by nulls]' \
+  '(-O)-o[sort arguments in ascending order]' \
+  '(-o)-O[sort arguments in descending order]' \
+  '-i[case-insensitive sorting]' \
+  '(-n -l -N -f -s -z)-a[with -c/-C, print arguments across before down]' \
+  '(-n -l -N -f -C -s -z)-c[print arguments in columns]' \
+  '(-n -l -N -f -c -s -z)-C+[print arguments in specified number of columns]:columns' \
+  '(-s -p -z)-u+[specify file descriptor to print arguments to]:file descriptor:_file_descriptors' \
+  '(-s -p -u)-z[push arguments onto editing buffer stack]' \
+  '-D[substitute any arguments which are named directories using ~ notation]' \
+  '-P[perform prompt expansion]' \
+  $pflag $eflag '*:default:_default'
diff --git a/Completion/Zsh/Command/_read b/Completion/Zsh/Command/_read
new file mode 100644
index 000000000..1f733b0e8
--- /dev/null
+++ b/Completion/Zsh/Command/_read
@@ -0,0 +1,21 @@
+#compdef read
+
+local pflag
+
+# -p flag only relevant if we have a coprocess
+(:>&p) 2>/dev/null &&
+  pflag='(-q -s -u -z)-p[input is read from the coprocess]'
+
+_arguments -s -A "-*" -S \
+  '-r[raw mode]' \
+  '(-p -k -s -u -z)-q[read y or n character from terminal]' \
+  '(-q)-k+[specify number of characters to read]:: :_guard "[0-9]#" "number of characters"' \
+  '(-q -z)-t+[test if input is available before reading]:: :_guard "[0-9.]#" "timeout (seconds)"' \
+  '(-q)-d[specify delimiter to terminate input instead of newline]:delimiter' \
+  '(-q -s -u -p -t)-z[read entry from editor buffer stack]' \
+  '(-E)-e[input read is echoed and not assigned]' \
+  '(-e)-E[input read is echoed]' \
+  '(-q -z -p)-s[suppress terminal echoing]' \
+  '-A[first name is taken as an array]' \
+  '(-q -z -p)-u+[specify file descriptor to read from]:file descriptor:_file_descriptors' \
+  $pflag '1:varprompt:_vars -qS\?' '*:vars:_vars'
diff --git a/Completion/Zsh/Command/_unhash b/Completion/Zsh/Command/_unhash
new file mode 100644
index 000000000..c05c27ea3
--- /dev/null
+++ b/Completion/Zsh/Command/_unhash
@@ -0,0 +1,14 @@
+#compdef unhash
+
+local expl state line curcontext="$curcontext"
+
+_arguments -C -s -S \
+  '(-a -f -s *)-d[remove named directories]:*:named directory:->nameddir' \
+  '(-d -f -s *)-a[remove aliases]:*:alias:_aliases' \
+  '(-a -d -f *)-s[remove suffix aliases]:*:suffix alias:_aliases -s s' \
+  '(-d -a -s *)-f[remove functions]:*:shell function:_functions' \
+  '-m[treat arguments as patterns]' \
+  '(-a -d -f -m)*:command: _command_names -e' && return 0
+
+[[ "$state" = nameddir ]] &&
+  _wanted named-directories expl 'named directory' compadd -k nameddirs
diff --git a/Completion/Zsh/Type/_arrays b/Completion/Zsh/Type/_arrays
new file mode 100644
index 000000000..24c8957e8
--- /dev/null
+++ b/Completion/Zsh/Type/_arrays
@@ -0,0 +1,5 @@
+#compdef shift
+
+local expl
+
+_wanted arrays expl array _parameters "$@" - -g '*array*'
diff --git a/Completion/Zsh/Type/_file_descriptors b/Completion/Zsh/Type/_file_descriptors
new file mode 100644
index 000000000..6d21ed2b6
--- /dev/null
+++ b/Completion/Zsh/Type/_file_descriptors
@@ -0,0 +1,29 @@
+#autoload
+
+local i fds expl list link sep
+
+for i in {0..9}; [[ -e /dev/fd/$i ]] && fds+=( $i )
+
+if zstyle -T ":completion:${curcontext}:" verbose && [[ -e /proc/$$/fd ]]; then
+  zstyle -s ":completion:${curcontext}:" list-separator sep || sep=--
+
+  if zmodload -e zsh/stat; then
+    for i in "${fds[@]}"; do
+      stat +link -A link /proc/$$/fd/$i
+      list+=( "$i $sep ${link[1]}" )
+    done
+  elif (( $+commands[readlink] )); then
+    for i in "${fds[@]}"; list+=( "$i $sep $(readlink /proc/$$/fd/$i)" )
+  else
+    for i in "${fds[@]}"; do
+      list+=( "$i $sep $(ls -l /proc/$$/fd/$i|sed 's/.*-> //' )" )
+    done
+  fi
+
+  if (( $list[(I)* $sep ?*] )); then
+    _wanted file-descriptors expl 'file descriptor' compadd "$@" -d list -a - fds
+    return
+  fi
+fi
+
+_wanted file-descriptors expl 'file descriptor' compadd -a "$@" - fds
diff --git a/Completion/Zsh/Type/_functions b/Completion/Zsh/Type/_functions
new file mode 100644
index 000000000..912a7f134
--- /dev/null
+++ b/Completion/Zsh/Type/_functions
@@ -0,0 +1,5 @@
+#compdef unfunction
+
+local expl
+
+_wanted functions expl 'shell function' compadd -k "$@" - functions
diff --git a/Completion/Zsh/Type/_jobs_bg b/Completion/Zsh/Type/_jobs_bg
new file mode 100644
index 000000000..0c1842203
--- /dev/null
+++ b/Completion/Zsh/Type/_jobs_bg
@@ -0,0 +1,3 @@
+#compdef bg
+
+_jobs -s "$@"
diff --git a/Completion/Zsh/Type/_jobs_fg b/Completion/Zsh/Type/_jobs_fg
new file mode 100644
index 000000000..57117f0d6
--- /dev/null
+++ b/Completion/Zsh/Type/_jobs_fg
@@ -0,0 +1,3 @@
+#compdef disown fg
+
+_jobs "$@"
diff --git a/Completion/Zsh/Type/_limits b/Completion/Zsh/Type/_limits
new file mode 100644
index 000000000..11ee7efaa
--- /dev/null
+++ b/Completion/Zsh/Type/_limits
@@ -0,0 +1,5 @@
+#compdef unlimit
+
+local expl
+
+_wanted limits expl 'process limit' compadd "$@" - ${${(f)"$(limit)"}%% *}
diff --git a/Completion/Zsh/Type/_options b/Completion/Zsh/Type/_options
new file mode 100644
index 000000000..c6cf30d99
--- /dev/null
+++ b/Completion/Zsh/Type/_options
@@ -0,0 +1,8 @@
+#autoload
+
+# This should be used to complete all option names.
+
+local expl
+
+_wanted zsh-options expl 'zsh option' \
+    compadd "$@" -M 'B:[nN][oO]= M:_= M:{A-Z}={a-z}' -k - options
diff --git a/Completion/Zsh/Type/_options_set b/Completion/Zsh/Type/_options_set
new file mode 100644
index 000000000..ddb57c3e2
--- /dev/null
+++ b/Completion/Zsh/Type/_options_set
@@ -0,0 +1,10 @@
+#autoload
+
+# Complete all set options. This relies on `_main_complete' to store the
+# names of the options that were set when it was called in the array
+# `_options_set'.
+
+local expl
+
+_wanted zsh-options expl 'set zsh option' \
+    compadd "$@" -M 'B:[nN][oO]= M:_= M:{A-Z}={a-z}' -a - _options_set
diff --git a/Completion/Zsh/Type/_options_unset b/Completion/Zsh/Type/_options_unset
new file mode 100644
index 000000000..32d58d427
--- /dev/null
+++ b/Completion/Zsh/Type/_options_unset
@@ -0,0 +1,10 @@
+#autoload
+
+# Complete all unset options. This relies on `_main_complete' to store the
+# names of the options that were unset when it was called in the array
+# `_options_unset'.
+
+local expl
+
+_wanted zsh-options expl 'unset zsh option' \
+    compadd "$@" -M 'B:[nN][oO]= M:_= M:{A-Z}={a-z}' -a - _options_unset