From 207ce1ec8ac5046a3a21bb0bcbc579224d08b8c6 Mon Sep 17 00:00:00 2001 From: Mark Small Date: Mon, 5 May 2014 22:53:14 +0100 Subject: [PATCH] Add auto-completion for puppet resource_type: Provides auto-complete options for puppet resource_type sub-command. --- custom/plugins/puppet/_puppet | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/custom/plugins/puppet/_puppet b/custom/plugins/puppet/_puppet index ad1a68193..f2ad25ed9 100644 --- a/custom/plugins/puppet/_puppet +++ b/custom/plugins/puppet/_puppet @@ -450,6 +450,18 @@ _resource_arguments=( '--types:List all available types' ) +local -a _resource_type_arguments +_resource_type_arguments=( + 'find:Retrieve info about a resource collection' + 'info:Print the default terminus class for this face' + 'search:Search for collections matching a regular expression' + '--render-as:FORMAT The rendering format to use' + '--verbose:Whether to log verbosely' + '--debug:Whether to log debug information' + '--extra:HASH Extra arguments to pass to the indirection request' + '--terminus: TERMINUS The indirector terminus to use' +) + __task_list () @@ -938,6 +950,23 @@ __puppet-resource () esac } +__puppet-resource_type () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + _describe -t commands "gem subcommand" _resource_type_arguments + return + ;; + esac +} + local expl @@ -1102,6 +1131,11 @@ case $state in (resource) __puppet-resource ;; + + # Display sub-commands for puppet resource_type. + (resource_type) + __puppet-resource_type + ;; esac ;; esac