From d0095421ac0fdb26e257600dceb81f0ae9a549a6 Mon Sep 17 00:00:00 2001 From: Mark Small Date: Mon, 5 May 2014 20:11:25 +0100 Subject: [PATCH] Add auto-completion for puppet file: Provides auto-complete options for puppet file sub-command. --- custom/plugins/puppet/_puppet | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/custom/plugins/puppet/_puppet b/custom/plugins/puppet/_puppet index 9a7189883..7a37e978d 100644 --- a/custom/plugins/puppet/_puppet +++ b/custom/plugins/puppet/_puppet @@ -233,6 +233,21 @@ _facts_arguments=( '--terminus: TERMINUS The indirector terminus to use' ) +local -a _file_arguments +_file_arguments=( + 'download:Download a file into the local filebucket' + 'find:Retrieve a file from the filebucket' + 'info:Print the default terminus class for this face' + 'save:API only: create or overwrite an object' + 'store:Store a file in the local filebucket' + '--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 @@ -447,6 +462,23 @@ __puppet-facts () esac } +__puppet-file () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + _describe -t commands "gem subcommand" _file_arguments + return + ;; + esac +} + local expl @@ -531,6 +563,11 @@ case $state in (facts) __puppet-facts ;; + + # Display sub-commands for puppet file. + (file) + __puppet-file + ;; esac ;; esac