From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 2840 invoked from network); 8 Jul 2020 11:32:11 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 8 Jul 2020 11:32:11 -0000 Received: (qmail 23499 invoked by alias); 8 Jul 2020 11:32:05 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: Sender: zsh-workers@zsh.org X-Seq: 46216 Received: (qmail 28302 invoked by uid 1010); 8 Jul 2020 11:32:05 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25863. spamassassin: 3.4.4. Clear:RC:0(205.235.26.22):SA:0(-2.3/5.0):. Processed in 1.828208 secs); 08 Jul 2020 11:32:05 -0000 X-Envelope-From: SRS0=AL8o=AT=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at bounces.park01.gkg.net designates 205.235.26.22 as permitted sender) X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 X-YMail-OSG: GOlmbTUVM1npy8c0zkSfBJOz1IvNbD8PpocdONEiQFjkx.i7_4NYmV7d3ASSeRK Bm2DW4NMVM6wpKFMUlsl5wk2OP0Gz4qjseIhUajTUx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Gb2cetb69XVTxwhjw9hbN2Y Ebn26.NU1POW_GZ6An0xcjS6C1LfKbDbdW6.XhL4CyO6O9saDHRnZJlrEiRIy.L9CLBmLpa5AA7l KiJ3w_a.tDkdhX6FmRJ6V7VSG.JQaz6V400mqjqZFEWvKKs0PBp6zk31kV7yZF2OXfHSoW5LDDzd SBrKHtZs3g6Mbvi9RceeAwMYVSKzej_GVa90WKM2t2NI0 From: Oliver Kiddle To: Zsh workers Subject: PATCH: update ansible completion to 2.9 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <77654.1594207879.1@hydra> Content-Transfer-Encoding: 8bit Date: Wed, 08 Jul 2020 13:31:19 +0200 Message-ID: <77655-1594207879.361279@1ICO.q8MP.Dgdc> References: <77655-1594207879.361279.ref@1ICO.q8MP.Dgdc> X-Mailer: WebService/1.1.16197 hermes_yahoo Apache-HttpAsyncClient/4.1.4 (Java/11.0.7) For 2.9.10 to be precise but I don't think much changes in the minor patch releases. Most of the changes appear to be with ansible-galaxy and ansible-vault, neither of which I use so much. Completing tags is new. Unfortunately the playbook tends to come last on the command-line after you've specified the tags so it isn't really possible to get the exact playbook and parse it for includes and roles. But completion for tags is too useful to leave out completely. Oliver diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible index f1e13a813..391e9cbbd 100644 --- a/Completion/Unix/Command/_ansible +++ b/Completion/Unix/Command/_ansible @@ -1,7 +1,7 @@ #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 curcontext="$curcontext" plug plugvar subcmd ign ret=1 +local -a args state line expl gactions local -A opt_args case $service in @@ -40,7 +40,7 @@ case $service in '!(-R --su-user -U --sudo-user)'{-R,-U,--su-user,--sudo-user}':user [root]:_users' ) ;| - ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull|ansible-vault) + ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull) args+=( '--ask-vault-pass[ask for vault password]' '--vault-id=[specify vault identity to use]:vault identity' @@ -72,7 +72,7 @@ case $service in ;| ansible-playbook|ansible-pull) args+=( - '(-t --tags)'{-t,--tags}'[only run plays and tasks tagged with these values]' + '(-t --tags)'{-t,--tags}'[only run plays and tasks tagged with these values]:tag:->tags' "--skip-tags[only run plays and tasks whose tags don't match]" ) ;| @@ -106,11 +106,12 @@ case $service in ;; ansible-doc) args+=( - '!(-l --list -F --list_files -s --snippet)'{-j,--json} # "internal testing only" + '!--metadata-dump' # "internal testing only" + '(-l --list -F --list_files -s --snippet)'{-j,--json}'[change output to json format]' '(-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]:(become cache callback cliconf connection httpapi inventory lookup shell module strategy vars)' + '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(become cache callback cliconf connection httpapi inventory lookup netconf shell module strategy vars)' '*:plugin:->plugins' ) ;; @@ -127,12 +128,12 @@ case $service in ) ;; ansible-galaxy) - args+=( -A "-*" $args + args=( -A "-*" $args '--list[list integrations]' '(-c --ignore-certs)'{-c,--ignore-certs}'[ignore SSL certificate validation errors]' '(-s --server)'{-s+,--server=}'[specify API server destination]:server destination' '--remove=[remove integration]:integration id' - '1:action:(delete import info init install list login remove search setup)' + '::type:(collection role)' '*::args:->galaxy' ) ;; @@ -168,9 +169,7 @@ case $service in ;; ansible-vault) args=( -A "-*" $args - '::action:(create decrypt edit encrypt encrypt_string rekey view)' - '--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' + '::action:compadd -M "r:|_=* r:|=*" - create decrypt edit encrypt encrypt_string rekey view' '*::args:->vault' ) ;; @@ -232,27 +231,68 @@ case $state in _wanted plugins expl "${plug} plugin" compadd -a $plugvar && ret=0 fi ;; + tags) + # The recursive glob here is questionable and perhaps there should be a style. + _sequence _wanted tags expl tag compadd - \ + ${(s.,.)${(j.,.)${(M)${(f)"$(cat **/*.yml)"}:# #tags:*}#*: }} && ret=0 + ;; galaxy) ign='' - curcontext="${curcontext%:*}-${line[1]}:" - (( $#words > 2 )) && ign='!' + gactions=( delete import info init install list login remove search setup ) + case ${(j.:.)line[1,3]} in + (role|collection):*:*) + subcmd="${line[1]}-${line[2]}" + ;; + collection:*) + gactions=( init build publish install ) + subcmd=collection + ;; + role:*) subcmd=role ;; + *:*) subcmd="role-${line[1]}" ;& + [^:]#) + words=( role "$words[@]" ) + (( CURRENT++ )) + ;; + esac + curcontext="${curcontext%:*}-${subcmd}:" + (( $#words > 3 )) && ign='!' args=( "${ign}(-)"{-h,--help}'[display usage information]' - '(-c --ignore-certs)'{-c,--ignore-certs}'[ignore SSL certificate validation errors]' - '(-s --server)'{-s+,--server=}'[specify API server destination]:server:_hosts' - {-v,--verbose}'[verbose mode]' + '1: :{ _wanted actions expl action compadd -a gactions }' ) - case $line[1] in - info|search|list|remove|install) + case $subcmd in + *-*) + args+=( + '(-c --ignore-certs)'{-c,--ignore-certs}'[ignore SSL certificate validation errors]' + '(-s --server)'{-s+,--server=}'[specify API server destination]:server:_hosts' + \*{-v,--verbose}'[verbose mode]' + ) + ;| + collection-*) + args+=( '--api-key=[specify ansible galaxy API key]:api key' ) + ;| + role-(info|search|list|remove|install)) args+=( '(-p --roles-path)'{-p,--roles-path}'[specify location of roles]:path:_directories' ) ;| - info|init) + role-(info|init)) args+=( "--offline[don't query the galaxy API]" ) ;| - init|install) - args+=( '(-f --force)'{-f,--force}'[force overwriting an existing role]' ) + *-(init|build|install)) + args+=( '(-f --force)'{-f,--force}'[force overwriting an existing role or collection]' ) ;| - search) + *-install) + args+=( + '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors and continue with the next specified role/collection]' + '(-n --no-deps)'{-n,--no-deps}"[don’t download roles/collections listed as dependencies]" + "--force-with-deps[force overwriting an existing role/collection and it's dependencies]" + ) + ;| + *-init) + args+=( + '--init-path=[specify path in which the skeleton will be created]:path:_directories' + ) + ;| + role-search) args+=( '--author=[specify GitHub username]:username' '--galaxy-tags=[specify list of galaxy tags to filter by]:galaxy tags' @@ -260,29 +300,25 @@ case $state in '*: :_guard "^-*" "search term"' ) ;; - setup) + role-setup) args+=( '--list[list integrations]' '--remove=[remove integration]:integration id' ) ;; - init) + role-init) args+=( - '--init-path=[specify path in which the skeleton role will be created]:path:_directories' - '--role-skeleton=[specify path to a role skeleton that the new role should be based upon]' + '--role-skeleton=[specify path to a role skeleton that the new role should be based upon]:path:_files' '--type=[initialize using an alternate role type]:role type:(container apb network)' ) ;; - install) + role-install) args+=( - "--force-with-deps[force overwriting an existing role and it's dependencies]" - '(-n --no-deps)'{-n,--no-deps}"[don’t download roles listed as dependencies]" - '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors and continue with the next specified role]' '(-g --keep-scm-meta)'{-g,--keep-scm-meta}'[use tar instead of the scm archive option when packaging the role]' '(-r --role-file)'{-r+,--role-file=}'[specify file containing a list of roles to be imported]:file:_files' ) ;; - import) + role-import) args+=( '--status[check the status of the most recent import request for given github_user/github_repo]' "--no-wait[don’t wait for import results]" @@ -290,24 +326,54 @@ case $state in '--role-name=[specify name the role should have]:role' ) ;; - login) + role-login) args+=( '--github-token=[identify with github token rather than username and password]' ) ;; + collection-build) + args+=( + '--output-path=[specify path in which the collection is built to]:path [.]:_directories' + ) + ;; + collection-init) + args+=( + '--collection-skeleton=[specify path to a collection skeleton that the new role should be based upon]:path:_files' + ) + ;; + collection-publish) + args+=( + "--no-wait[don't wait for import validation results]" + '--import-timeout=[specify time to wait for import process]:time' + ) + ;; + collection-install) + args+=( + '(-p --collections-path)'{-p+,--collections-path=}'[specify directory containing collections]:_directories' + '(-r --requirements-file)'{-r+,--requirements-file=}'[specify file containing a list of collections to install]:file:_files' + ) + ;; esac - _arguments -s -S $args && ret=0 + _arguments -s -S : $args && ret=0 ;; vault) + ign='' curcontext="${curcontext%:*}-${line[1]}:" - args=() + (( $#words > 2 )) && ign='!' + args=( + "${ign}(-)"{-h,--help}'[display usage information]' + '--ask-vault-pass[ask for vault password]' + '--vault-id=[specify vault identity to use]:vault identity' + '--vault-password-file=[specify vault password file]:vault password file:_files' + \*{-v,--verbose}'[verbose mode]' + ) case $line[1] in - encrypt*|edit|rekey) + create|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' ) ;| + (de|en)crypt*) args+=( '--output=[specify output file name]:file:_files' ) ;| encrypt_string) args+=( '(-p --prompt)'{-p,--prompt}'[prompt for the string to encrypt]' @@ -316,7 +382,12 @@ case $state in ) ;| create|edit|rekey|view) args+=( ':file:_files' ) ;| - (en|de)crypt) args+=( '::file:_files' ) + (en|de)crypt) args+=( '::file:_files' ) ;; + rekey) + args+=( + '--new-vault-id=[specify new vault identity to use]:vault identity' + '--new-vault-password-file=[specify new vault password file]:vault password file:_files' + ) ;; esac _arguments -s -S $args && ret=0