From afd008d96bee0993ebbca697f93917b0897207bd Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 21 Jun 2018 13:28:24 +0200 Subject: 43073: various completion option updates --- Completion/Unix/Command/_ansible | 52 +++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 16 deletions(-) (limited to 'Completion/Unix/Command/_ansible') diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible index f05dac8a6..330ef66b7 100644 --- a/Completion/Unix/Command/_ansible +++ b/Completion/Unix/Command/_ansible @@ -30,7 +30,7 @@ case $service in '(-D --diff)'{-D,--diff}'[show differences when changing small files and templates]' '(-b --become)'{-b,--become}'[escalate privileges on remote system]' '(-f --forks)'{-f+,--forks=}'[specify number of parallel processes to use]:processes [5]' - '--become-method=[specify privilege escalation method to use]:method [sudo]:(sudo su pbrun pfexec doas dzdo ksu runas pmrun)' + '--become-method=[specify privilege escalation method to use]:method [sudo]:(sesu sudo su pbrun pfexec doas dzdo ksu runas pmrun enable)' '--become-user=[specify remote user for running operations]:user:_users' "--syntax-check[perform a syntax check on the playbook, but don't execute it]" '!(-R --su-user -U --sudo-user)'{-R,-U,--su-user,--sudo-user}':user [root]:_users' @@ -39,17 +39,20 @@ case $service in ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull|ansible-vault) args+=( '--ask-vault-pass[ask for vault password]' - '--new-vault-id=[specify new vault identity to use for rekey]:vault id' - '--new-vault-password-file=[specify new vault password file to use for rekey]:file:_files' '--vault-id=[specify vault identity to use]:vault identity' '--vault-password-file=[specify vault password file]:vault password file:_files' ) ;| ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull) args+=( - '--list-hosts[output list of matching hosts]' - '(-i --inventory)'{-i+,--inventory=}'[specify inventory host file]:inventory file:_files' + '(-i --inventory)'{-i+,--inventory=}'[specify inventory host file or host list]: : _alternative "files\:inventory file\:_files" + "hosts\:host\: _sequence _hosts"' '!(-i --inventory)--inventory-file=:inventory file:_files' + ) + ;| + ansible|ansible-console|ansible-playbook|ansible-pull) + args+=( + '--list-hosts[output list of matching hosts]' '(-l --limit)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts' ) ;| @@ -58,21 +61,22 @@ case $service in '(-e --extra-vars)'{-e+,--extra-vars=}'[set additional variables]:key=value or YAML/JSON' ) ;| - ansible-playbook|ansible-pull) + ansible|ansible-console|ansible-inventory) args+=( - '(-t --tags)'{-t,--tags}'[only run plays and tasks tagged with these values]' - "--skip-tags[only run plays and tasks whose tags don't match]" + '--playbook-dir=[specify substitute playbook directory]:directory:_directories' ) ;| - ansible|ansible-pull) + ansible-playbook|ansible-pull) args+=( - '(-m --module-name)'{-m+,--module-name=}'[specify module]:module:->plugins' + '(-t --tags)'{-t,--tags}'[only run plays and tasks tagged with these values]' + "--skip-tags[only run plays and tasks whose tags don't match]" ) ;| ansible) args+=( '(-a --args)'{-a+,--args=}'[specify command or module arguments]:arguments:->args' '(-B --background)'{-B+,--background=}'[run asynchronously, failing after specified time]:fail timeout (seconds)' + '(-m --module-name)'{-m+,--module-name=}'[specify module]:module:->plugins' '(-o --one-line)'{-o,--one-line}'[condense output]' '(-P --poll)'{-P+,--poll=}'[specify the poll interval if using -B]:interval (seconds) [15]' '(-t --tree)'{-t+,--tree=}'[specify directory for log output]:directory:_directories' @@ -98,14 +102,16 @@ case $service in ;; ansible-doc) args+=( - '(-l --list)'{-l,--list}'[list available plugins]' - '(-s --snippet)'{-s,--snippet}'[show playbook snippet for specified plugins]' + '(-l --list -F --list_files -s --snippet)'{-l,--list}'[list available plugins]' + '(-l --list -F --list_files -s --snippet)'{-F,--list_files}'[show plugin names and their source files without summaries]' + '(-l --list -F --list_files -s --snippet)'{-s,--snippet}'[show playbook snippet for specified plugins]' '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(cache callback connection inventory lookup module strategy vars)' '*:plugin:->plugins' ) ;; ansible-inventory) args+=( + '--export[when doing an --list, represent in a way that is optimized for export]' '(-y --yaml)--graph[output inventory graph]' '--host[output specific host information]' '--list[output all hosts information]' @@ -125,7 +131,7 @@ case $service in ;; ansible-playbook) args+=( - '--flush-cache[clear the fact cache]' + '--flush-cache[clear the fact cache for every host in inventory]' '--force-handlers[run handlers even if a task fails]' '--list-tags[list all available tags]' '--list-tasks[list all tasks that would be executed]' @@ -139,6 +145,7 @@ case $service in "--check[don't make any changes]" '(-d --directory)'{-d+,--directory=}'[specify directory to checkout repository to]:directory:_directories' '--full[do a full instead of a shallow clone]' + '(-m --module-name)'{-m+,--module-name=}'[specify repository module used for checking out repository]:module:(git subversion hg bzr)' '--accept-host-key[adds the hostkey for the repo url if not already added]' '--purge[purge checkout after playbook run]' '(-f --force)'{-f,--force}'[run the playbook even if the repository could not be updated]' @@ -153,6 +160,8 @@ case $service in ;; ansible-vault) args=( -A "-*" $args + '--new-vault-id=[specify new vault identity to use for rekey]:vault id' + '--new-vault-password-file=[specify new vault password file to use for rekey]:file:_files' '*::args:->vault' ) ;; @@ -200,9 +209,15 @@ case $state in plugins) plugvar=_ansible_${plug}_plugins typeset -ga ${plug} - (( ${(P)#plugvar} )) || set -A ${plugvar} \ - ${${(f)"$(_call_program plugins ansible-doc -t $plug -l)"}/ ##/:} - _describe -t plugins "${plug} plugin" $plugvar && ret=0 + 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 && ret=0 + else + (( ${(P)#plugvar} )) || set -A ${plugvar} \ + ${${(f)"$(_call_program plugins ansible-doc -t $plug -F)"}%% *} + _wanted plugins expl "${plug} plugin" compadd -a $plugvar && ret=0 + fi ;; galaxy) curcontext="${curcontext%:*}-${line[1]}:" @@ -265,6 +280,11 @@ case $state in curcontext="${curcontext%:*}-${line[1]}:" args=() case $line[1] in + encrypt*|edit|rekey) + args+=( + '--encrypt-vault-id=[specify vault id to use to encrypt (required if more than one vault-id is provided)]:vault id' + ) + ;| (de|en)crypt*) args=( '--output=[specify output file name]:file:_files' ) ;| encrypt_string) args+=( -- cgit 1.4.1