zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@zsh.org>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: handle keywords in ansible-doc completion
Date: Mon, 18 Mar 2024 21:10:55 +0100	[thread overview]
Message-ID: <32485-1710792655.301933@5q5c.sOTD.WMKT> (raw)

When listing available keywords, a trailing colon is included which is
unwanted when passing a particular keyword to ansible-doc. This stips
the trailing colon.

Also, --step is valid for ansible-playbook and had got left out.

Oliver

diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible
index bf31819ad..e0d9fb9b6 100644
--- a/Completion/Unix/Command/_ansible
+++ b/Completion/Unix/Command/_ansible
@@ -69,6 +69,11 @@ case $service in
       "--skip-tags[only run plays and tasks whose tags don't match]"
     )
   ;|
+  ansible-playbook|ansible-console)
+    args+=(
+      '--step[one-step-at-a-time: confirm each task before running]'
+    )
+  ;|
   ansible|ansible-console)
     args+=(
       '--task-timeout[set the task timeout limit]:timeout (seconds)'
@@ -97,11 +102,6 @@ case $service in
       '*::args:->config'
     )
   ;;
-  ansible-console)
-    args+=(
-      '--step[one-step-at-a-time: confirm each task before running]'
-    )
-  ;;
   ansible-doc)
     args+=(
       '!--metadata-dump' '!--no-fail-on-errors' # "internal use only"
@@ -440,11 +440,11 @@ if [[ $state = plugins ]]; then
   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)"}/ ##/:}
+        ${${${(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)"}%% *}
+        ${${(f)"$(_call_program plugins ansible-doc -t $plug -F)"}%%(|:) *}
     _wanted plugins expl "${plug} plugin" compadd -M 'r:|.=* r:|=*' -a $plugvar && ret=0
   fi
 fi


                 reply	other threads:[~2024-03-18 20:11 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=32485-1710792655.301933@5q5c.sOTD.WMKT \
    --to=opk@zsh.org \
    --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).