diff options
Diffstat (limited to 'Completion/Zsh/Function')
-rw-r--r-- | Completion/Zsh/Function/__arguments | 44 | ||||
-rw-r--r-- | Completion/Zsh/Function/_add-zle-hook-widget | 9 | ||||
-rw-r--r-- | Completion/Zsh/Function/_add-zsh-hook | 11 | ||||
-rw-r--r-- | Completion/Zsh/Function/_vcs_info | 31 | ||||
-rw-r--r-- | Completion/Zsh/Function/_zargs | 20 |
5 files changed, 98 insertions, 17 deletions
diff --git a/Completion/Zsh/Function/__arguments b/Completion/Zsh/Function/__arguments new file mode 100644 index 000000000..af7710971 --- /dev/null +++ b/Completion/Zsh/Function/__arguments @@ -0,0 +1,44 @@ +#compdef _arguments + +# Dear reader: This function is called "__arguments" and is the completion +# function for the completion function _arguments. This function, however, is +# not the completion function _arguments. If you're looking for the function +# _arguments, then you've come to the wrong place. +# +# _arguments is a completion utility function. It is called by completion +# functions for command-line tools. +# +# __arguments is a completion function for _arguments. It runs when one does +# `_arguments -<TAB>' at the shell prompt to jog one's memory about _arguments' +# option flags. +# +# _arguments is in documented in the manual. If you were looking for its +# source code, that'd be either in ../../../Completion/Base/Utility/_arguments +# or in ./_arguments, depending on where you're reading this file. +# +# __arguments takes no arguments. + +if (( ${words[(i)--]} < CURRENT )); then + # "Deriving spec forms from the help output" + _arguments : \ + '*-i[specify option name exclude patterns]:option name exclude pattern' \ + '*-s[specify option aliases]:pattern and replacement as "(this that)"' \ + '*:helpspec (pattern\:message\:action)' +else + _arguments -A '-([AMO]*|[0CRSWnsw])' : \ + '!-n[set $NORMARG]' \ + '-s[enable single-letter option stacking (-x -y == -xy)]' \ + '-w[(rarely needed) enable single-letter option stacking with arguments (-x X -y == -xy X)]' \ + '-W[(rarely needed) enable single-letter option stacking with arguments in the same word (-x X -y == -xXy)]' \ + "-C[modify \$curcontext for \`->action' (instead of \$context)]" \ + "-R[when \`->action' matches, return 300]" \ + "-S[honour \`--' as end-of-options guard]" \ + "-A[do not complete options after non-options]:pattern matching unknown options (e.g., '-*')" \ + '-O[pass elements of array variable to function calls in actions]:array variable name:_parameters -g array' \ + "-M[specify matchspec for completing option names and values]:matchspec for completing option names and values [ 'r\\:|[_-]=* r\\:|=*' ]" \ + '-0[have ${(v)opt_args} be NUL-joined rather than colon-escaped and colon-joined]' \ + "--[derive optspecs from \`\${command} --help' output]" \ + '1::optional delimiter:(\:)' \ + '*:spec (e.g., "(-t --to)"*{-t+,--to=}"[specify recipient]\:recipient'\''s address\:_email_addresses)' + # TODO: doesn't support "Specifying Multiple Sets of Arguments" +fi diff --git a/Completion/Zsh/Function/_add-zle-hook-widget b/Completion/Zsh/Function/_add-zle-hook-widget index f108d1868..c0bd77819 100644 --- a/Completion/Zsh/Function/_add-zle-hook-widget +++ b/Completion/Zsh/Function/_add-zle-hook-widget @@ -26,9 +26,12 @@ _add-zle-hook-widget() { local context state state_descr line typeset -A opt_args _arguments -s -w -S : \ - '(-D)-d[remove HOOK from the array]' \ - '(-d)-D[interpret HOOK as pattern to remove from the array]' \ - {-U,-z,-k}"[passed to 'autoload']" \ + "(-d -D -U -z -k)-L[output in form of 'zstyle' commands]" \ + '(-L -D -U -z -k)-d[remove HOOK from the array]' \ + '(-L -d -U -z -k)-D[interpret HOOK as pattern to remove from the array]' \ + '(-L -d -D)-U[suppress alias expansion for functions]' \ + '(-L -d -D -k)-z[mark function for zsh-style autoloading]' \ + '(-L -d -D -z)-k[mark function for ksh-style autoloading]' \ ':hook type:_add-zle-hook-widget_types' \ ':widget:_add-zle-hook-widget_widgets' } diff --git a/Completion/Zsh/Function/_add-zsh-hook b/Completion/Zsh/Function/_add-zsh-hook index e8ae97052..5b1ff0e42 100644 --- a/Completion/Zsh/Function/_add-zsh-hook +++ b/Completion/Zsh/Function/_add-zsh-hook @@ -3,7 +3,7 @@ _add-zsh-hook_hooks() { local expl if (( $+opt_args[-d] )); then - _wanted functions expl "installed hooks" compadd -a - "$line[1]_functions" && return 0 + _wanted functions expl "installed hook" compadd -a - "$line[1]_functions" && return 0 else _functions && return 0 fi @@ -14,9 +14,12 @@ _add-zsh-hook() { local context state state_descr line typeset -A opt_args _arguments -s -w -S : \ - '(-D)-d[remove HOOK from the array]' \ - '(-d)-D[interpret HOOK as pattern to remove from the array]' \ - {-U,-z,-k}"[passed to 'autoload']" \ + "(-d -D -U -z -k)-L[output in form of 'typeset' commands]" \ + '(-L -D -U -z -k)-d[remove HOOK from the array]' \ + '(-L -d -U -z -k)-D[interpret HOOK as pattern to remove from the array]' \ + '(-L -d -D)-U[suppress alias expansion for functions]' \ + '(-L -d -D -k)-z[mark function for zsh-style autoloading]' \ + '(-L -d -D -z)-k[mark function for ksh-style autoloading]' \ ':hook class:(chpwd precmd preexec periodic zshaddhistory zshexit zsh_directory_name)' \ ':hook function:_add-zsh-hook_hooks' } diff --git a/Completion/Zsh/Function/_vcs_info b/Completion/Zsh/Function/_vcs_info new file mode 100644 index 000000000..fdb28de6a --- /dev/null +++ b/Completion/Zsh/Function/_vcs_info @@ -0,0 +1,31 @@ +#compdef vcs_info_hookadd vcs_info_hookdel + +local -a hook_types=( + gen-applied-string + gen-hg-bookmark-string + gen-mqguards-string + gen-unapplied-string + no-vcs + post-backend + post-quilt + pre-addon-quilt + pre-get-data + set-branch-format + set-hgrev-format + set-message + set-patch-format + start-up +) + +local -a specs +case $service in + (vcs_info_hookdel) + specs=( '-a[remove all occurrences, not just the first]' ) + ;; +esac + +# TODO: for vcs_info_hookdel complete only functions installed for that hook +_arguments : \ + $specs \ + ":hook type:($hook_types)" \ + '*:hook function:_vcs_info_hooks' diff --git a/Completion/Zsh/Function/_zargs b/Completion/Zsh/Function/_zargs index f974ab646..94a35e3a5 100644 --- a/Completion/Zsh/Function/_zargs +++ b/Completion/Zsh/Function/_zargs @@ -18,17 +18,17 @@ case $numeofs in #zargs arguments arguments=( '(--eof -e)'{--eof=,-e+}'[change the end-of-input-args string from "--" to eof-str]' - '(--exit, -x)'{--exit,-x}'[exit if the size (see --max-chars) is exceeded]' + '(--exit -x)'{--exit,-x}'[exit if the size (see --max-chars) is exceeded]' '--help[print summary and exit]' - '(--interactive, -p)'{--interactive,-p}'[prompt before executing each command line]' - '(--max-args, -n)'{--max-args=,-n+}'[use at most max-args arguments per command line]' - '(--max-chars, -s)'{--max-chars=,-s+}'[use at most max-chars characters per command line]' - '(--max-lines, -l)'{--max-lines=,-l+}'[use at most max-lines of the input-args per command line]' - '(--max-procs, -P)'{--max-procs=,-P+}'[run up to max-procs command lines in the background at once]' - '(--no-run-if-empty, -r)'{--no-run-if-empty,-r}'[do nothing if there are no input arguments before the eof-str]' - '(--null, -0)'{--null,-0}'[split each input-arg at null bytes, for xargs compatibility]' - '(--replace, -i)'{--replace=,-i}'[substitute replace-str in the initial-args by each initial-arg]' - '(--verbose, -t)'{--verbose,-t}'[print each command line to stderr before executing it]' + '(--interactive -p)'{--interactive,-p}'[prompt before executing each command line]' + '(--max-args -n)'{--max-args=,-n+}'[use at most max-args arguments per command line]' + '(--max-chars -s)'{--max-chars=,-s+}'[use at most max-chars characters per command line]' + '(--max-lines -l)'{--max-lines=,-l+}'[use at most max-lines of the input-args per command line]' + '(--max-procs -P)'{--max-procs=,-P+}'[run up to max-procs command lines in the background at once]' + '(--no-run-if-empty -r)'{--no-run-if-empty,-r}'[do nothing if there are no input arguments before the eof-str]' + '(--null -0)'{--null,-0}'[split each input-arg at null bytes, for xargs compatibility]' + '(--replace -i)'{--replace=,-i}'[substitute replace-str in the initial-args by each initial-arg]' + '(--verbose -t)'{--verbose,-t}'[print each command line to stderr before executing it]' '--version[print the version number of zargs and exit]' ) _arguments -S -s $arguments[@] && ret=0 |