From eaae32d0c30840ef720059353c39145c2dcfdb5c Mon Sep 17 00:00:00 2001 From: Mark Small Date: Mon, 5 May 2014 19:23:45 +0100 Subject: [PATCH] Add auto-completion for puppet config: Provides auto-complete options for puppet config 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 b34506dcd..7cde17e9f 100644 --- a/custom/plugins/puppet/_puppet +++ b/custom/plugins/puppet/_puppet @@ -170,6 +170,16 @@ _certificate_revocation_list_arguments=( '--terminus: TERMINUS The indirector terminus to use' ) +local -a _config_arguments +_config_arguments=( + "print:Examine Puppet's current settings" + "set:Set Puppet's settings" + '--render-as:FORMAT The rendering format to use' + '--verbose:Whether to log verbosely' + '--debug:Whether to log debug information' + '--section:SECTION_NAME The section of the configuration file to interact with' +) + __task_list () { local expl @@ -299,6 +309,23 @@ __puppet-certificate_revocation_list () esac } +__puppet-config () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + _describe -t commands "gem subcommand" _config_arguments + return + ;; + esac +} + local expl @@ -358,6 +385,11 @@ case $state in (certificate_revocation_list) __puppet-certificate_revocation_list ;; + + # Display sub-commands for puppet config. + (config) + __puppet-config + ;; esac ;; esac