From d306e2fc27d2b5917fde85594f898c08cc378e7d Mon Sep 17 00:00:00 2001 From: Mark Small Date: Sun, 4 May 2014 23:26:44 +0100 Subject: [PATCH] Add auto-completion for puppet catalog: Provides auto-complete options for puppet catalog sub-command. --- custom/plugins/puppet/_puppet | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/custom/plugins/puppet/_puppet b/custom/plugins/puppet/_puppet index 9a8397524..7dc2349ef 100644 --- a/custom/plugins/puppet/_puppet +++ b/custom/plugins/puppet/_puppet @@ -105,6 +105,19 @@ _ca_arguments=( 'verify:undocumented action' ) +local -a _catalog_arguments +_catalog_arguments=( + 'apply:Find and apply a catalog' + "download:Download this node's catalog from the puppet master server" + 'find:Retrieve the catalog for a node' + 'info:Print the default terminus class for this face' + 'save:API only: create or overwrite an object' + 'select:Retrieve a catalog and filter it for resources of a given type' + '--render-as:FORMAT The rendering format to use' + '--verbose:Whether to log verbosely' + '--debug:Whether to log debug information' +) + __task_list () { local expl @@ -166,6 +179,23 @@ __puppet-ca () esac } +__puppet-catalog () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + _describe -t commands "gem subcommand" _catalog_arguments + return + ;; + esac +} + local expl @@ -205,6 +235,11 @@ case $state in (ca) __puppet-ca ;; + + # Display sub-commands for puppet catalog. + (catalog) + __puppet-catalog + ;; esac ;; esac