summaryrefslogtreecommitdiff
path: root/Completion/Zsh/Command
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Zsh/Command')
-rw-r--r--Completion/Zsh/Command/_builtin2
-rw-r--r--Completion/Zsh/Command/_command6
-rw-r--r--Completion/Zsh/Command/_compadd12
-rw-r--r--Completion/Zsh/Command/_exec4
-rw-r--r--Completion/Zsh/Command/_precommand5
-rw-r--r--Completion/Zsh/Command/_typeset1
-rw-r--r--Completion/Zsh/Command/_zftp2
-rw-r--r--Completion/Zsh/Command/_zparseopts37
8 files changed, 51 insertions, 18 deletions
diff --git a/Completion/Zsh/Command/_builtin b/Completion/Zsh/Command/_builtin
index 9fb6acf7b..ffb7b8c8d 100644
--- a/Completion/Zsh/Command/_builtin
+++ b/Completion/Zsh/Command/_builtin
@@ -3,7 +3,7 @@
if (( $CURRENT > 2 )); then
shift words
(( CURRENT -- ))
- _normal
+ _normal -p $service
else
local expl
diff --git a/Completion/Zsh/Command/_command b/Completion/Zsh/Command/_command
index 4e2858676..503f860a2 100644
--- a/Completion/Zsh/Command/_command
+++ b/Completion/Zsh/Command/_command
@@ -1,11 +1,7 @@
#compdef command
-# indicate if this is a precommand modifier
-[[ $service = command ]] && precommands+=(command)
-
_arguments \
'-v[indicate result of command search]:*:command:_path_commands' \
'-V[show result of command search in verbose form]:*:command:_path_commands' \
'(-)-p[use default PATH to find command]' \
- ':command:_path_commands' \
- '*::arguments: _normal'
+ '*:: : _normal -p $service'
diff --git a/Completion/Zsh/Command/_compadd b/Completion/Zsh/Command/_compadd
index e709e400e..781fa2af8 100644
--- a/Completion/Zsh/Command/_compadd
+++ b/Completion/Zsh/Command/_compadd
@@ -14,9 +14,13 @@ _arguments -C -s -S -A "-*" \
'(-a)-k[matches are keys of specified associative arrays]' \
'-d+[specify display strings]:array:_parameters -g "*array*"' \
'-l[list display strings one per line, not in columns]' \
- '-o[order matches by match string not by display string]' \
- '(-1 -E)-J+[specify match group which will be sorted]:group' \
- '-V+[specify pre-ordered match group]:group' \
+ '-o[specify order for matches by match string not by display string]:: : _values -s , order
+ "match[order by match not by display string]"
+ "nosort[matches are pre-ordered]"
+ "numeric[order numerically]"
+ "reverse[order backwards]"' \
+ '(-1 -E)-J+[specify match group]:group' \
+ '!-V+:group' \
'(-J -E)-1[remove only consecutive duplicates from group]' \
'-2[preserve all duplicates]' \
'(-x)-X[specify explanation]:explanation' \
@@ -45,7 +49,7 @@ if [[ -n $state ]]; then
elif (( $+opt_args[-k] )); then
_parameters -g "*assoc*" && ret=0
else
- _message -e candidate candidates
+ _message -e candidates candidate
fi
fi
diff --git a/Completion/Zsh/Command/_exec b/Completion/Zsh/Command/_exec
index 8de341a02..2498b57c0 100644
--- a/Completion/Zsh/Command/_exec
+++ b/Completion/Zsh/Command/_exec
@@ -1,9 +1,7 @@
#compdef exec
-[[ $service == exec ]] && precommands+=( exec )
-
_arguments -s -S -A '-*' : \
'-a+[set argv\[0\] to specified string]:argv[0] string' \
'-c[clear environment]' \
'-l[simulate login shell (prepend - to argv\[0\])]' \
- '*:: : _normal'
+ '*:: : _normal -p $service'
diff --git a/Completion/Zsh/Command/_precommand b/Completion/Zsh/Command/_precommand
index c9eef78af..fd88074c0 100644
--- a/Completion/Zsh/Command/_precommand
+++ b/Completion/Zsh/Command/_precommand
@@ -1,9 +1,6 @@
#compdef - nohup eval time rusage noglob nocorrect catchsegv aoss hilite eatmydata
-# precommands is made local in _main_complete
-precommands+=($words[1])
-
shift words
(( CURRENT-- ))
-_normal
+_normal -p $service
diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset
index fb7189c77..ae33ae539 100644
--- a/Completion/Zsh/Command/_typeset
+++ b/Completion/Zsh/Command/_typeset
@@ -61,6 +61,7 @@ case ${service} in
'(-k -t -T -u -U -W -x -z -M +M +k +t +W +z)-+M[define mathematical function]'
'(-k -m -t -T -u -U -W -x -z +M +k +t +W +z)-s[define mathematical function that takes a string argument]'
'(-M)-x+[specify spaces to use for indentation]:spaces'
+ '(-* +*)-c[copy shell function to another name]:old name:_functions:new name:_functions'
)
;;
integer)
diff --git a/Completion/Zsh/Command/_zftp b/Completion/Zsh/Command/_zftp
index 105533055..a41d72ce2 100644
--- a/Completion/Zsh/Command/_zftp
+++ b/Completion/Zsh/Command/_zftp
@@ -1,4 +1,4 @@
-#compdef -p zf*
+#compdef -P zf*
# Completion for zftp builtin and zf* functions. The functions
# zfcd_match and zfget_match (also used for old-style completion)
diff --git a/Completion/Zsh/Command/_zparseopts b/Completion/Zsh/Command/_zparseopts
new file mode 100644
index 000000000..e13a91081
--- /dev/null
+++ b/Completion/Zsh/Command/_zparseopts
@@ -0,0 +1,37 @@
+#compdef zparseopts
+
+local ret=1
+local -a context line state state_descr alts opts
+local -A opt_args
+
+_arguments -A '-*' : \
+ '-a+[specify array in which to store parsed options]:array:_parameters -g "*array*~*readonly*"' \
+ '-A+[specify association in which to store parsed options]:association:_parameters -g "*association*~*readonly*"' \
+ '-D[remove parsed options from positional parameters]' \
+ "-E[don't stop parsing at first parameter not described by specs]" \
+ '-F[abort parsing and print error at first option-like parameter not described by specs]' \
+ '-K[preserve contents of arrays/associations when specs are not matched]' \
+ '-M[enable mapping among equivalent options with opt1=opt2 spec form]' \
+ '(-)-[end zparseopts options; specs follow]' \
+ '*: :->spec' \
+&& ret=0
+
+[[ $state == spec ]] &&
+if compset -P '*='; then
+ alts=()
+ (( $+opt_args[-M] )) && {
+ opts=( $line )
+ [[ $opts[1] == (-|--) ]] && shift opts
+ opts=( ${(@)opts%%(+|)(:|:-|::|)(=*|)} )
+ opts=( ${(@)opts:#${words[CURRENT]%%=*}} )
+ alts+=( "spec-opt-names:spec option name:(${(j< >)${(@q+)opts}})" )
+ }
+ alts+=( 'parameters:array:_parameters -g "*array*~*readonly*"' )
+ _alternative $alts && ret=0
+else
+ # Not great, but close enough for now
+ compset -S '=*'
+ _message -e spec-opts 'spec option (name[+][:|:-|::])' && ret=0
+fi
+
+return ret