From 41838d0aaf9bbb9c7e38e1b353e51ae8a1a19f7b Mon Sep 17 00:00:00 2001 From: Mark Small Date: Mon, 5 May 2014 21:45:53 +0100 Subject: [PATCH] Add auto-completion for puppet man: Provides auto-complete options for puppet man sub-command. --- custom/plugins/puppet/_puppet | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/custom/plugins/puppet/_puppet b/custom/plugins/puppet/_puppet index 954d95c7a..81583610b 100644 --- a/custom/plugins/puppet/_puppet +++ b/custom/plugins/puppet/_puppet @@ -350,6 +350,14 @@ _kick_arguments=( '--ping:Do an ICMP echo against the target host' ) +local -a _man_arguments +_man_arguments=( + 'man:Display the manual page for a Puppet subcommand' + '--render-as:FORMAT The rendering format to use' + '--verbose:Whether to log verbosely' + '--debug:Whether to log debug information' +) + __task_list () { @@ -701,6 +709,23 @@ __puppet-kick () esac } +__puppet-man () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + _describe -t commands "gem subcommand" _man_arguments + return + ;; + esac +} + local expl @@ -825,6 +850,11 @@ case $state in (kick) __puppet-kick ;; + + # Display sub-commands for puppet man. + (man) + __puppet-man + ;; esac ;; esac