Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: ansible environment variable completion
- X-seq: zsh-workers 44356
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: ansible environment variable completion
- Date: Thu, 23 May 2019 16:42:20 +0200
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1558622545; bh=zzBny9lsdikFeXb1AdOvNfkRJ2E5K9FODbNuY3rhRCE=; h=From:To:Subject:Date:From:Subject; b=PJTRjJ+EKabMU1TXKiDggKdaezvP2k5+rWHP8wz8/hB+aP0X/U2EuaP1LcH2zTdGNTTwgtgblcO4Y60XTppAuFI1lsla1b8WSXeOdAzhDoPUiF7lGuO1Jd9lkldiyL1Xw8Pf4jxuy4g6pt8+qY6K/6tALuGSQyWPZBjQ5oZbOnRaxX3DjmdAyDrRAuQu5sbzQEFFivIMOzcAgHFM0ECQMNSwMQcDQzIEQioDn6xsfGkZspVFyJ7yre52Tnjl8mpeavQcJPvFuvgL8bvPYj6k1DgIjiXfLPyMoR5fvta4kXDzlPvQmmT9LqgSTFmXZ15WtTX30xH8gdYdnHCOgAdEww==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author