packer-cn/contrib/zsh-completion/_packer

67 lines
2.3 KiB
Plaintext
Raw Normal View History

_packer () {
local -a sub_commands && sub_commands=(
2015-04-04 06:51:59 -04:00
'build:Build image(s) from template'
'fix:Fixes templates from old versions of packer'
'inspect:See components of a template'
'push:Push template files to a Packer build service'
'validate:Check that a template is valid'
'version:Prints the Packer version'
)
2015-04-04 06:51:59 -04:00
local -a build_arguments && build_arguments=(
'-debug[Debug mode enabled for builds]'
'-force[Force a build to continue if artifacts exist, deletes existing artifacts]'
'-machine-readable[Machine-readable output]'
'-except=[(foo,bar,baz) Build all builds other than these]'
'-only=[(foo,bar,baz) Only build the given builds by name]'
'-parallel=[(false) Disable parallelization (on by default)]'
'-var[("key=value") Variable for templates, can be used multiple times.]'
'-var-file=[(path) JSON file containing user variables.]'
'(-)*:files:_files -g "*.json"'
)
local -a inspect_arguments && inspect_arguments=(
2015-04-04 06:51:59 -04:00
'-machine-readable[Machine-readable output]'
'(-)*:files:_files -g "*.json"'
)
2015-04-04 06:51:59 -04:00
local -a push_arguments && push_arguments=(
'-name=[(<name>) The destination build in Atlas.]'
'-token=[(<token>) Access token to use to upload.]'
'-var[("key=value") Variable for templates, can be used multiple times.]'
'-var-file=[(path) JSON file containing user variables.]'
'(-)*:files:_files -g "*.json"'
)
2015-04-04 06:51:59 -04:00
local -a validate_arguments && validate_arguments=(
'-syntax-only[Only check syntax. Do not verify config of the template.]'
'-except=[(foo,bar,baz) Validate all builds other than these]'
'-only=[(foo,bar,baz) Validate only these builds]'
'-var[("key=value") Variable for templates, can be used multiple times.]'
'-var-file=[(path) JSON file containing user variables.]'
'(-)*:files:_files -g "*.json"'
)
2015-04-04 06:51:59 -04:00
_arguments -C \
':command:->command' \
'*::options:->options'
2015-04-04 06:51:59 -04:00
case $state in
command)
_describe -t commands 'command' sub_commands ;;
options)
case $line[1] in
build)
_arguments -s -S : $build_arguments ;;
inspect)
_arguments -s -S : $inspect_arguments ;;
push)
_arguments -s -S : $push_arguments ;;
validate)
_arguments -s -S : $validate_arguments ;;
esac
;;
esac
}
_packer "$@"