mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 05:28:40 -05:00
Update completion scripts for service subcommands
This commit is contained in:
parent
1e81c78a5b
commit
c5b9e1d184
2 changed files with 29 additions and 15 deletions
|
|
@ -1,26 +1,32 @@
|
|||
_floaty()
|
||||
{
|
||||
local line subcommands template_subcommands hostname_subcommands
|
||||
local line commands template_arg_commands hostname_arg_commands service_subcommands
|
||||
|
||||
subcommands="delete get help list modify query revert snapshot ssh status summary token"
|
||||
commands="delete get help list modify query revert service snapshot ssh status summary token"
|
||||
|
||||
template_subcommands=("get" "ssh")
|
||||
hostname_subcommands=("delete" "modify" "query" "revert" "snapshot")
|
||||
template_arg_commands=("get" "ssh")
|
||||
hostname_arg_commands=("delete" "modify" "query" "revert" "snapshot")
|
||||
service_subcommands=("types" "examples")
|
||||
|
||||
_arguments -C \
|
||||
"1: :(${subcommands})" \
|
||||
"1: :(${commands})" \
|
||||
"*::arg:->args"
|
||||
|
||||
if ((template_subcommands[(Ie)$line[1]])); then
|
||||
if ((template_arg_commands[(Ie)$line[1]])); then
|
||||
_floaty_template_sub
|
||||
elif ((hostname_subcommands[(Ie)$line[1]])); then
|
||||
elif ((hostname_arg_commands[(Ie)$line[1]])); then
|
||||
_floaty_hostname_sub
|
||||
elif [[ "service" == $line[1] ]]; then
|
||||
_arguments "1: :(${service_subcommands})"
|
||||
fi
|
||||
}
|
||||
|
||||
_floaty_template_sub()
|
||||
{
|
||||
if [[ -z "$_vmfloaty_avail_templates" ]] ; then
|
||||
# TODO: need a --hostnameonly equivalent here because the section headers of
|
||||
# `floaty list` are adding some spurious entries (including files in current
|
||||
# directory because part of the headers is `**` which is getting expanded)
|
||||
_vmfloaty_avail_templates=$(floaty list 2>/dev/null)
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue