1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-06-10 18:58:03 +02:00

51474: make -e and --vault-id options repeatable and update for new options to ansible 2.13.2

This commit is contained in:
Oliver Kiddle 2023-02-24 12:34:14 +01:00
parent 82f307bddf
commit f604645d06
2 changed files with 69 additions and 25 deletions
ChangeLog
Completion/Unix/Command

View file

@ -1,3 +1,8 @@
2023-02-24 Oliver Kiddle <opk@zsh.org>
* 51474: Completion/Unix/Command/_ansible: make -e and --vault-id
options repeatable and update for new options to ansible 2.13.2
2023-02-21 Peter Stephenson <p.stephenson@samsung.com> 2023-02-21 Peter Stephenson <p.stephenson@samsung.com>
* 51466: Src/params.c: fix access to autoloaded parameter. * 51466: Src/params.c: fix access to autoloaded parameter.

View file

@ -20,8 +20,10 @@ case $service in
;| ;|
ansible|ansible-console|ansible-playbook|ansible-pull) ansible|ansible-console|ansible-playbook|ansible-pull)
args+=( args+=(
'(-K --ask-become-pass)'{-K,--ask-become-pass}'[ask for privilege escalation password]' '(-K --ask-become-pass --become-password-file)'{-K,--ask-become-pass}'[ask for privilege escalation password]'
'(-k --ask-pass)'{-k,--ask-pass}'[ask for connection password]' '(-K --ask-become-pass)--become-password-file=[specify file containing become password]:file:_files'
'(-k --ask-pass --connection-password-file)'{-k,--ask-pass}'[ask for connection password]'
'(-k --ask-pass)--connection-password-file=[specify file containing connection password]:file:_files'
'--list-hosts[output list of matching hosts]' '--list-hosts[output list of matching hosts]'
'(-l --limit)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts' '(-l --limit)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts'
'(-T --timeout)'{-T+,--timeout=}'[override the connection timeout]:timeout (seconds) [10]' '(-T --timeout)'{-T+,--timeout=}'[override the connection timeout]:timeout (seconds) [10]'
@ -49,8 +51,8 @@ case $service in
ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull) ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull)
args+=( args+=(
--ask-vault-pass{,word}'[ask for vault password]' --ask-vault-pass{,word}'[ask for vault password]'
'(-e --extra-vars)'{-e+,--extra-vars=}'[set additional variables]:key=value or YAML/JSON' \*{-e+,--extra-vars=}'[set additional variables]:key=value, YAML/JSON or @file:->extra-vars'
'--vault-id=[specify vault identity to use]:vault identity' '*--vault-id=[specify vault identity to use]:vault identity'
--vault-pass{,word}-file='[specify vault password file]:vault password file:_files' --vault-pass{,word}-file='[specify vault password file]:vault password file:_files'
\*{-i+,--inventory=}'[specify inventory host file or host list]: : _alternative "files\:inventory file\:_files" \*{-i+,--inventory=}'[specify inventory host file or host list]: : _alternative "files\:inventory file\:_files"
"hosts\:host\: _sequence _hosts"' "hosts\:host\: _sequence _hosts"'
@ -86,15 +88,15 @@ case $service in
) )
;; ;;
ansible-config) ansible-config)
args+=( args=( -A "-*" $args
'(-c --config)'{-c+,--config=}'[specify configuration file]:config file:_files'
'1:action:(( '1:action:((
list\:list\ all\ configuration list\:list\ all\ configuration
dump\:show\ the\ current\ settings,\ merge\ specified\ configuration dump\:show\ the\ current\ settings,\ merge\ specified\ configuration
view\:display\ the\ current\ config\ file view\:display\ the\ current\ config\ file
init\:create\ initial\ configuration
))' ))'
'*::args:->config'
) )
[[ -n $words[(r)dump] ]] && args+=( '--only-changed[only show configuration that is changed from the default]' )
;; ;;
ansible-console) ansible-console)
args+=( args+=(
@ -103,11 +105,11 @@ case $service in
;; ;;
ansible-doc) ansible-doc)
args+=( args+=(
'!--metadata-dump' # "internal testing only" '!--metadata-dump' '!--no-fail-on-errors' # "internal use only"
'(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-j,--json}'[change output to json format]' '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-j,--json}'[change output to json format]'
'(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-l,--list}'[list available plugins]' '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-l,--list}'[list available plugins]'
'(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-F,--list_files}'[show plugin names and their source files without summaries]' '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-F,--list_files}'[show plugin names and their source files without summaries]'
'(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-s,--snippet}'[show playbook snippet for specified plugins]' '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-s,--snippet}'[show playbook snippet for inventory, lookup and module plugins]'
'(-l --list -F --list_files -s --snippet -e --entry-point)--metadata-dump[dump json metadata for all plugins]' '(-l --list -F --list_files -s --snippet -e --entry-point)--metadata-dump[dump json metadata for all plugins]'
'(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-e+,--entry-point=}'[select the entry point for roles]:entry point' '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-e+,--entry-point=}'[select the entry point for roles]:entry point'
'(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(become cache callback cliconf connection httpapi inventory lookup netconf shell vars module strategy role keyword)' '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(become cache callback cliconf connection httpapi inventory lookup netconf shell vars module strategy role keyword)'
@ -218,18 +220,13 @@ case $state in
;; ;;
connect-types) connect-types)
plug=connection plug=connection
;& state=plugins
plugins) ;;
plugvar=_ansible_${plug}_plugins extra-vars)
typeset -ga ${plug} if compset -P '@'; then
if zstyle -T ":completion:${curcontext}:plugins" verbose; then _files -g "*.(json|yml|yaml|ini)(-.)" && ret=0
(( ${(P)#plugvar} )) || set -A ${plugvar} \
${${(f)"$(_call_program plugins ansible-doc -t $plug -l)"}/ ##/:}
_describe -t plugins "${plug} plugin" $plugvar -M 'r:|.=* r:|=*' && ret=0
else else
(( ${(P)#plugvar} )) || set -A ${plugvar} \ _message 'key=value, YAML/JSON or @file'
${${(f)"$(_call_program plugins ansible-doc -t $plug -F)"}%% *}
_wanted plugins expl "${plug} plugin" compadd -M 'r:|.=* r:|=*' -a $plugvar && ret=0
fi fi
;; ;;
tags) tags)
@ -237,9 +234,39 @@ case $state in
_sequence _wanted tags expl tag compadd - \ _sequence _wanted tags expl tag compadd - \
${(s.,.)${(j.,.)${(M)${(f)"$(cat **/*.yml)"}:# #tags:*}#*: }} && ret=0 ${(s.,.)${(j.,.)${(M)${(f)"$(cat **/*.yml)"}:# #tags:*}#*: }} && ret=0
;; ;;
config)
ign=''
curcontext="${curcontext%:*}-${words[1]}:"
(( $#words > 3 )) && ign='!'
args=(
"${ign}(-)"{-h,--help}'[display usage information]'
\*{-v,--verbose}'[verbose mode]'
'(-c --config)'{-c+,--config=}'[specify configuration file]:config file:_files'
'(-t --type)'{-t+,--type=}'[filter down to a specific plugin type]:plugin type [base]:(all base become cache callback cliconf connection httpapi inventory lookup netconf shell vars)'
'*:plugin:->plugins'
)
case $words[1] in
dump)
args+=(
'(--only-changed --changed-only)'{--only-changed,--changed-only}'[only show configuration that is changed from the default]'
)
;;
init)
args+=(
'--format=[specify output format for init]:format:(init env vars)'
'--disabled[prefix all entries with a comment character]'
)
;;
esac
_arguments -s -S : $args && ret=0
plug=${(v)opt_args[(i)-(t|-type)]}
[[ $plug = base ]] && state=
;;
galaxy) galaxy)
ign='' ign=''
gactions=( delete import info init install list remove search setup ) gactions=( delete import info init install list remove search setup )
args=( "${ign}(-)"{-h,--help}'[display usage information]' )
(( $#words > 3 )) && ign='!'
case ${(j.:.)line[1,3]} in case ${(j.:.)line[1,3]} in
(role|collection):*:*) (role|collection):*:*)
subcmd="${line[1]}-${line[2]}" subcmd="${line[1]}-${line[2]}"
@ -253,14 +280,11 @@ case $state in
[^:]#) [^:]#)
words=( role "$words[@]" ) words=( role "$words[@]" )
(( CURRENT++ )) (( CURRENT++ ))
args=()
;; ;;
esac esac
curcontext="${curcontext%:*}-${subcmd}:" curcontext="${curcontext%:*}-${subcmd}:"
(( $#words > 3 )) && ign='!' args+=( '1: :{ _wanted actions expl action compadd -a gactions }' )
args=(
"${ign}(-)"{-h,--help}'[display usage information]'
'1: :{ _wanted actions expl action compadd -a gactions }'
)
case $subcmd in case $subcmd in
*-*) *-*)
args+=( args+=(
@ -403,4 +427,19 @@ case $state in
;; ;;
esac esac
if [[ $state = plugins ]]; then
[[ -z $plug ]] && return ret
plugvar=_ansible_${plug}_plugins
typeset -ga ${plug}
if zstyle -T ":completion:${curcontext}:plugins" verbose; then
(( ${(P)#plugvar} )) || set -A ${plugvar} \
${${(f)"$(_call_program plugins ansible-doc -t $plug -l)"}/ ##/:}
_describe -t plugins "${plug} plugin" $plugvar -M 'r:|.=* r:|=*' && ret=0
else
(( ${(P)#plugvar} )) || set -A ${plugvar} \
${${(f)"$(_call_program plugins ansible-doc -t $plug -F)"}%% *}
_wanted plugins expl "${plug} plugin" compadd -M 'r:|.=* r:|=*' -a $plugvar && ret=0
fi
fi
return ret return ret