From 911310f2c2762ab9fa50e26db36feba08ef430c6 Mon Sep 17 00:00:00 2001 From: Mark Small Date: Sun, 4 May 2014 23:28:10 +0100 Subject: [PATCH] Add auto-completion for puppet cert: Provides auto-complete options for puppet cert sub-command. --- custom/plugins/puppet/_puppet | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/custom/plugins/puppet/_puppet b/custom/plugins/puppet/_puppet index 7dc2349ef..630931d7a 100644 --- a/custom/plugins/puppet/_puppet +++ b/custom/plugins/puppet/_puppet @@ -118,6 +118,19 @@ _catalog_arguments=( '--debug:Whether to log debug information' ) +local -a _cert_arguments +_cert_arguments=( + "clean:'Revoke a host's certificate (if applicable) and remove all files related to that host from puppet cert's storage" + 'fingerprint:Print the DIGEST (defaults to the signing algorithm) fingerprint of a host's certificate' + 'generate:Generate a certificate for a named client' + 'list:List outstanding certificate requests' + "print:Print the full-text version of a host's certificate." + 'revoke:Revoke the certificate of a client' + 'sign:Sign an outstanding certificate request' + 'verify:Verify the named certificate against the local CA certificate' + 'reinventory:Build an inventory of the issued certificates' +) + __task_list () { local expl @@ -196,6 +209,23 @@ __puppet-catalog () esac } +__puppet-cert () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + _describe -t commands "gem subcommand" _cert_arguments + return + ;; + esac +} + local expl @@ -240,6 +270,11 @@ case $state in (catalog) __puppet-catalog ;; + + # Display sub-commands for puppet cert. + (cert) + __puppet-cert + ;; esac ;; esac