From cc4294dd45e29016db8153efb4cc6cbdff6a1ad9 Mon Sep 17 00:00:00 2001 From: Mark Small Date: Mon, 5 May 2014 22:07:16 +0100 Subject: [PATCH] Add auto-completion for puppet module: Provides auto-complete options for puppet module sub-command. --- custom/plugins/puppet/_puppet | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/custom/plugins/puppet/_puppet b/custom/plugins/puppet/_puppet index 0e5a011cf..ff0e2da58 100644 --- a/custom/plugins/puppet/_puppet +++ b/custom/plugins/puppet/_puppet @@ -376,6 +376,22 @@ _master_arguments=( '--compile: Compile a catalogue and output it in JSON from the puppet master' ) +local -a _module_arguments +_module_arguments=( + 'build:Build a module release package' + 'changes:Show modified files of an installed module' + 'generate:Generate boilerplate for a new module' + 'install:Install a module from the Puppet Forge or a release archive' + 'list:List installed modules' + 'search:Search the Puppet Forge for a module' + 'uninstall:Uninstall a puppet module' + 'upgrade:Upgrade a puppet module' + '-verbose:Whether to log verbosely' + '--debug:Whether to log debug information' + '--environment: production The environment Puppet is running in' + '--modulepath:$basemodulepath The search path for modules' +) + __task_list () @@ -762,6 +778,23 @@ __puppet-master () esac } +__puppet-module () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + _describe -t commands "gem subcommand" _module_arguments + return + ;; + esac +} + local expl @@ -896,6 +929,11 @@ case $state in (master) __puppet-master ;; + + # Display sub-commands for puppet module. + (module) + __puppet-module + ;; esac ;; esac