From 0b0593a22d975c8ee9acc9996983e6cc865e5438 Mon Sep 17 00:00:00 2001 From: Mark Small Date: Mon, 5 May 2014 19:37:12 +0100 Subject: [PATCH] Add auto-completion for puppet describe: Provides auto-complete options for puppet describe sub-command. --- custom/plugins/puppet/_puppet | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/custom/plugins/puppet/_puppet b/custom/plugins/puppet/_puppet index 7cde17e9f..610ff35a6 100644 --- a/custom/plugins/puppet/_puppet +++ b/custom/plugins/puppet/_puppet @@ -180,6 +180,15 @@ _config_arguments=( '--section:SECTION_NAME The section of the configuration file to interact with' ) +local -a _describe_arguments +_describe_arguments=( + '--help:Print this help text' + '--providers:Describe providers in detail for each type' + '--list:List all types' + '--meta:List all metaparameters' + '--short:List only parameters without detail' +) + __task_list () { local expl @@ -326,6 +335,23 @@ __puppet-config () esac } +__puppet-describe () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + _describe -t commands "gem subcommand" _describe_arguments + return + ;; + esac +} + local expl @@ -390,6 +416,11 @@ case $state in (config) __puppet-config ;; + + # Display sub-commands for puppet describe. + (describe) + __puppet-describe + ;; esac ;; esac