From 9080167f45764e89a42b7c83e4678b89c01371a2 Mon Sep 17 00:00:00 2001 From: Mark Small Date: Mon, 5 May 2014 17:54:46 +0100 Subject: [PATCH] Add auto-completion for puppet certificate: Provides auto-complete options for puppet certificate sub-command. --- custom/plugins/puppet/_puppet | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/custom/plugins/puppet/_puppet b/custom/plugins/puppet/_puppet index 7d4ec6f00..751a7fa11 100644 --- a/custom/plugins/puppet/_puppet +++ b/custom/plugins/puppet/_puppet @@ -131,6 +131,16 @@ _cert_arguments=( 'reinventory:Build an inventory of the issued certificates' ) +local -a _certificate_arguments +_certificate_arguments=( + 'destroy:Delete a certificate' + 'find:Retrieve a certificate' + 'generate:Generate a new certificate signing request' + 'info:Print the default terminus class for this face' + 'list:List all certificate signing requests' + 'sign:Sign a certificate signing request for HOST' +) + __task_list () { local expl @@ -226,6 +236,23 @@ __puppet-cert () esac } +__puppet-certificate () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + _describe -t commands "gem subcommand" _certificate_arguments + return + ;; + esac +} + local expl @@ -275,6 +302,11 @@ case $state in (cert) __puppet-cert ;; + + # Display sub-commands for puppet certificate. + (certificate) + __puppet-certificate + ;; esac ;; esac