From dc1d497b8799432a916ae4963d192d2c74fd182a Mon Sep 17 00:00:00 2001 From: Mark Small Date: Mon, 5 May 2014 22:49:09 +0100 Subject: [PATCH] Add auto-completion for puppet resource: Provides auto-complete options for puppet resource sub-command. --- custom/plugins/puppet/_puppet | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/custom/plugins/puppet/_puppet b/custom/plugins/puppet/_puppet index 83c01be8e..ad1a68193 100644 --- a/custom/plugins/puppet/_puppet +++ b/custom/plugins/puppet/_puppet @@ -432,6 +432,24 @@ _report_arguments=( '--terminus: TERMINUS The indirector terminus to use' ) +local -a _resource_arguments +_resource_arguments=( + '-h:Print this help message' + '--help:Print this help message' + '-d:Enable full debugging' + '--debug:Enable full debugging' + '-v:Print extra information' + '--verbose:Print extra information' + '-e:Write the results of the query to a file' + '--edit:Write the results of the query to a file' + '-H: When specified, connect to the resource server on the named host and retrieve the list of resouces of the type specified' + '--host: When specified, connect to the resource server on the named host and retrieve the list of resouces of the type specified' + '-p: Add more parameters to be outputted from queries' + '--param: Add more parameters to be outputted from queries' + '-t:List all available types' + '--types:List all available types' +) + __task_list () @@ -903,6 +921,23 @@ __puppet-report () esac } +__puppet-resource () +{ + 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_arguments + return + ;; + esac +} + local expl @@ -1062,6 +1097,11 @@ case $state in (report) __puppet-report ;; + + # Display sub-commands for puppet resource. + (resource) + __puppet-resource + ;; esac ;; esac