From 48240a1dee4ad79c8c1faba2e0722012bce168a5 Mon Sep 17 00:00:00 2001 From: Mark Small Date: Mon, 5 May 2014 20:07:24 +0100 Subject: [PATCH] Add auto-completion for puppet facts: Provides auto-complete options for puppet facts 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 7f4741392..9a7189883 100644 --- a/custom/plugins/puppet/_puppet +++ b/custom/plugins/puppet/_puppet @@ -221,6 +221,18 @@ _doc_arguments=( "--charset: Used only in 'rdoc' mode" ) +local -a _facts_arguments +_facts_arguments=( + "find:Retrieve a node's facts" + 'info:Print the default terminus class for this face' + 'save:API only: create or overwrite an object' + '--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 () { local expl @@ -418,6 +430,23 @@ __puppet-doc () esac } +__puppet-facts () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + _describe -t commands "gem subcommand" _facts_arguments + return + ;; + esac +} + local expl @@ -497,6 +526,11 @@ case $state in (doc) __puppet-doc ;; + + # Display sub-commands for puppet facts. + (facts) + __puppet-facts + ;; esac ;; esac