* PATCH: ansible environment variable completion
@ 2019-05-23 14:42 Oliver Kiddle
0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2019-05-23 14:42 UTC (permalink / raw)
To: Zsh workers
ansible looks at quite a large number of environment variables but for
my uses, I needed to set ANSIBLE_STDOUT_CALLBACK. This makes it complete
callback plugins for that.
Oliver
diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible
index 89a4998b7..a6e586da3 100644
--- a/Completion/Unix/Command/_ansible
+++ b/Completion/Unix/Command/_ansible
@@ -1,10 +1,14 @@
-#compdef ansible ansible-config ansible-console ansible-doc ansible-galaxy ansible-inventory ansible-playbook ansible-pull ansible-vault
+#compdef ansible ansible-config ansible-console ansible-doc ansible-galaxy ansible-inventory ansible-playbook ansible-pull ansible-vault -value-,ANSIBLE_STDOUT_CALLBACK,-default-
local curcontext="$curcontext" plug plugvar ign ret=1
local -a args state line
local -A opt_args
case $service in
+ *,ANSIBLE_STDOUT_CALLBACK,*)
+ plug=callback
+ state=plugins
+ ;;
ansible|ansible-console|ansible-doc|ansible-playbook)
args=(
\*{-M+,--module-path=}'[specify path to modules]:module path:_dir_list'
@@ -30,7 +34,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 enable machinectl)'
+ '--become-method=[specify privilege escalation method to use]:method [sudo]:(sesu sudo su pbrun pfexec doas dzdo ksu runas pmrun enable machinectl)'
'--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'
@@ -170,12 +174,15 @@ case $service in
esac
(( $#words > 2 )) && ign='!'
-_arguments -s -S -C $args \
- "${ign}(- :)--version[display version information]" \
- "${ign}(- :)"{-h,--help}'[display usage information]' \
- \*{-v,--verbose}"[verbose mode (repeat to increase)]" && ret=0
+if (( $#args )); then
+ _arguments -s -S -C $args \
+ "${ign}(- :)--version[display version information]" \
+ "${ign}(- :)"{-h,--help}'[display usage information]' \
+ \*{-v,--verbose}"[verbose mode (repeat to increase)]" && ret=0
+
+ plug=${(v)opt_args[(i)-(t|-type)]:-module}
+fi
-plug=${(v)opt_args[(i)-(t|-type)]:-module}
case $state in
args)
case ${(v)opt_args[(I)-(m|module)]} in
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-05-23 14:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-23 14:42 PATCH: ansible environment variable completion Oliver Kiddle
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).