github.com/hashicorp/packer@v1.14.3/contrib/zsh-completion/_packer (about) 1 #compdef packer 2 3 _packer () { 4 local -a sub_commands && sub_commands=( 5 'build:Build image(s) from template' 6 'console:Creates a console for testing variable interpolation' 7 'fix:Fixes templates from old versions of packer' 8 'fmt:Rewrites HCL2 config files to canonical format' 9 'hcl2_upgrade:Transform a JSON template into an HCL2 configuration' 10 'init:Install missing plugins or upgrade plugins' 11 'inspect:See components of a template' 12 'plugins:Interact with Packer plugins and catalog' 13 'validate:Check that a template is valid' 14 'version:Prints the Packer version' 15 ) 16 17 local -a build_arguments && build_arguments=( 18 '-debug[Debug mode enabled for builds.]' 19 '-force[Force a build to continue if artifacts exist, deletes existing artifacts.]' 20 '-machine-readable[Produce machine-readable output.]' 21 '-color=[(false) Disable color output. (Default: color)]' 22 '-except=[(foo,bar,baz) Run all builds and post-processors other than these.]' 23 '-on-error=[(cleanup,abort,ask) If the build fails do: clean up (default), abort, or ask.]' 24 '-only=[(foo,bar,baz) Only build the given builds by name.]' 25 '-parallel=[(false) Disable parallelization. (Default: false)]' 26 '-parallel-builds=[(0) Number of builds to run in parallel. (Defaults to infinite: 0)]' 27 '-timestamp-ui[Enable prefixing of each ui output with an RFC3339 timestamp]' 28 '-var[("key=value") Variable for templates, can be used multiple times.]' 29 '-var-file=[(path) JSON or HCL2 file containing user variables.]' 30 '-warn-on-undeclared-var[Display warnings for user variable files containing undeclared variables.]' 31 '(-)*:files:_files -g "*pkr.{hcl,json}"' 32 ) 33 34 local -a console_arguments && console_arguments=( 35 '-var[("key=value") Variable for templates, can be used multiple times.]' 36 '-var-file=[(path) JSON or HCL2 file containing user variables.]' 37 '(-)*:files:_files -g "*pkr.{hcl,json}"' 38 ) 39 40 local -a fix_arguments && fix_arguments=( 41 '(-)*:files:_files -g "*.json"' 42 ) 43 44 local -a fmt_arguments && fmt_arguments=( 45 '-check[Check if the input is formatted. Exit status 0 = properly formatted, non-zero otherwise.]' 46 '-diff[Display diffs of formatting change]' 47 '-write=[(false) Don not write to source files (always disabled if using -check)]' 48 '-recursive[Also process files in subdirectories. By default cwd only]' 49 '(-)*:files:_files -g "*pkr.{hcl,json}"' 50 ) 51 52 local -a init_arguments && init_arguments=( 53 '-upgrade[on top also update plugins to latest]' 54 '(-)*:files:_files -g "*pkr.{hcl,json}"' 55 ) 56 57 local -a inspect_arguments && inspect_arguments=( 58 '-machine-readable[Machine-readable output]' 59 '(-)*:files:_files -g "*pkr.{hcl,json}"' 60 ) 61 62 local -a validate_arguments && validate_arguments=( 63 '-syntax-only[Only check syntax. Do not verify config of the template.]' 64 '-except=[(foo,bar,baz) Validate all builds other than these.]' 65 '-only=[(foo,bar,baz) Validate only these builds.]' 66 '-var[("key=value") Variable for templates, can be used multiple times.]' 67 '-var-file=[(path) JSON or HCL2 file containing user variables.]' 68 '-no-warn-undeclared-var[Disable warnings for user variable files containing undeclared variables.]' 69 '-evaluate-datasources[(false) Evaluate data sources during validation (HCL2 only, may incur costs).]' 70 '(-)*:files:_files -g "*pkr.{hcl,json}"' 71 ) 72 73 _arguments -C \ 74 ':command:->command' \ 75 '*::options:->options' 76 77 case $state in 78 command) 79 _describe -t commands 'command' sub_commands ;; 80 options) 81 case $line[1] in 82 build) 83 _arguments -s -S : $build_arguments ;; 84 console) 85 _arguments -s -S : $console_arguments ;; 86 fix) 87 _arguments -s -S : $fix_arguments ;; 88 fmt) 89 _arguments -s -S : $fmt_arguments ;; 90 init) 91 _arguments -s -S : $init_arguments ;; 92 inspect) 93 _arguments -s -S : $inspect_arguments ;; 94 validate) 95 _arguments -s -S : $validate_arguments ;; 96 esac 97 ;; 98 esac 99 } 100 _packer "$@"