From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: ansible environment variable completion
Date: Thu, 23 May 2019 16:42:20 +0200 [thread overview]
Message-ID: <43160-1558622540.972414@q7gc.BJmo.SMIp> (raw)
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
reply other threads:[~2019-05-23 14:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43160-1558622540.972414@q7gc.BJmo.SMIp \
--to=okiddle@yahoo.co.uk \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).