zsh-completion: remove -d, --doc, argument expectation

and small formatting changes.
This commit is contained in:
Eric Cook 2015-09-19 18:25:39 -04:00
parent 115c1ed8ec
commit 973a2b46fd

View File

@ -14,8 +14,7 @@ local state line curcontext="$curcontext" salt_dir cachefn
_modules(){
local _funcs cachefn expl curcontext=${curcontext%:*}:modules
zstyle -s ":completion:$curcontext:" cache-policy cachefn
if [[ -z $cachefn ]]; then
if ! zstyle -T ":completion:$curcontext:" cache-policy; then
zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
fi
@ -30,8 +29,7 @@ _modules(){
_minions(){
local _peons cachefn expl curcontext=${curcontext%:*}:minions
zstyle -s ":completion:$curcontext:" cache-policy cachefn
if [[ -z $cachefn ]]; then
if ! zstyle -T ":completion:$curcontext:" cache-policy; then
zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
fi
@ -53,8 +51,8 @@ _salt_caching_policy() {
local -a _{target,master,logging,minion}_options _{common,out}_opts _target_opt_pat
_target_opt_pat=(
'(-[ELGNRCIS]|--(pcre|list|grain(|-pcre)|nodegroup|range|compound|pillar|ipcidr))'
'(-E --pcre -L --list -G --grain --grain-pcre -N --nodegroup -R --range -C --compound -I --pillar -S --ipcidr)'
'(-[ELGNRCIS]|--(pcre|list|grain(|-pcre)|nodegroup|range|compound|pillar|ipcidr))'
'(-E --pcre -L --list -G --grain --grain-pcre -N --nodegroup -R --range -C --compound -I --pillar -S --ipcidr)'
)
_target_options=(
@ -88,13 +86,13 @@ _master_options=(
'(-a --auth --eauth --extrenal-auth)'{-a,--auth,--eauth,--external-auth}'[Specify an external authentication system to use.]:eauth:'
'(-T --make-token)'{-T,--make-token}'[Generate and save an authentication token for re-use.]'
'--return[Set an alternative return method.]:Returners:_path_files -W "$salt_dir/returners" -g "[^_]*.py(\:r)"'
'(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]:Module:_path_files -W "$salt_dir/modules" -g "[^_]*.py(\:r)"'
'(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]'
'--args-separator[Set the special argument used as a delimiter between command arguments of compound commands.]:Arg separator:'
)
_minion_options=(
'--return[Set an alternative return method.]:Returners:_path_files -W "$salt_dir"/returners" -g "[^_]*.py(\:r)"'
'(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]:Module:_path_files -W "$salt_dir/modules" -g "[^_]*.py(\:r)"'
'(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]'
'(-g --grains)'{-g,--grains}'[Return the information generated by the salt grains]'
{*-m,*--module-dirs}'[Specify an additional directory to pull modules from.]:Module Dirs:_files -/'
'--master[Specify the master to use.]:Master:'
@ -155,9 +153,8 @@ _salt_comp(){
() {
local curcontext=${curcontext%:*}:salt_dir
zstyle -s ":completion:$curcontext:" cache-policy cachefn
if [[ -z $cachefn ]]; then
zstyle ":completion:${curcontext%:*}:salt_dir:" cache-policy _salt_caching_policy
if ! zstyle -T ":completion:$curcontext:" cache-policy; then
zstyle ":completion:$curcontext:" cache-policy _salt_caching_policy
fi
if _cache_invalid salt/salt_dir || ! _retrieve_cache salt/salt_dir; then