From 6dd78d676e34f6e385dd3ea80892cee21edd3f44 Mon Sep 17 00:00:00 2001 From: Mark Small Date: Mon, 5 May 2014 22:20:03 +0100 Subject: [PATCH] Add auto-completion for puppet plugin: Provides auto-complete options for puppet plugin sub-command. --- custom/plugins/puppet/_puppet | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/custom/plugins/puppet/_puppet b/custom/plugins/puppet/_puppet index 9ba17db16..62d8fe3f9 100644 --- a/custom/plugins/puppet/_puppet +++ b/custom/plugins/puppet/_puppet @@ -412,6 +412,14 @@ _parser_arguments=( '--debug:Whether to log debug information' ) +local -a _plugin_arguments +_plugin_arguments=( + 'download:Download plugins from the puppet master' + '--render-as:FORMAT The rendering format to use' + '--verbose:Whether to log verbosely' + '--debug:Whether to log debug information' +) + __task_list () @@ -849,6 +857,23 @@ __puppet-parser () esac } +__puppet-plugin () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + _describe -t commands "gem subcommand" _plugin_arguments + return + ;; + esac +} + local expl @@ -998,6 +1023,11 @@ case $state in (parser) __puppet-parser ;; + + # Display sub-commands for puppet plugin. + (plugin) + __puppet-plugin + ;; esac ;; esac