github.com/kimor79/packer@v0.8.7-0.20151221212622-d507b18eb4cf/contrib/zsh-completion/_packer (about)

     1  #compdef packer
     2  
     3  local -a _packer_cmds
     4  _packer_cmds=(
     5      'build:Build image(s) from template'
     6      'fix:Fixes templates from old versions of packer'
     7      'inspect:See components of a template'
     8      'push:Push template files to a Packer build service'
     9      'validate:Check that a template is valid'
    10      'version:Prints the Packer version'
    11  )
    12  
    13  __build() {
    14      _arguments \
    15        '-debug[Debug mode enabled for builds]' \
    16        '-force[Force a build to continue if artifacts exist, deletes existing artifacts]' \
    17        '-machine-readable[Machine-readable output]' \
    18        '-except=[(foo,bar,baz) Build all builds other than these]' \
    19        '-only=[(foo,bar,baz) Only build the given builds by name]' \
    20        '-parallel=[(false) Disable parallelization (on by default)]' \
    21        '-var[("key=value") Variable for templates, can be used multiple times.]' \
    22        '-var-file=[(path) JSON file containing user variables.]'
    23  }
    24  
    25  
    26  __inspect() {
    27    _arguments \
    28      '-machine-readable[Machine-readable output]' 
    29  }
    30  
    31  __push() {
    32    _arguments \
    33      '-create[Create the build configuration if it does not exist].' \
    34      '-token=[(<token>) Access token to use to upload.]'
    35  }
    36  
    37  __validate() {
    38      _arguments \
    39        '-syntax-only[Only check syntax. Do not verify config of the template.]' \
    40        '-except=[(foo,bar,baz) Validate all builds other than these]' \
    41        '-only=[(foo,bar,baz) Validate only these builds]' \
    42        '-var[("key=value") Variable for templates, can be used multiple times.]' \
    43        '-var-file=[(path) JSON file containing user variables.]'
    44  }
    45  
    46  
    47  _arguments '*:: :->command'
    48  
    49  if (( CURRENT == 1 )); then
    50    _describe -t commands "packer command" _packer_cmds
    51    return
    52  fi
    53  
    54  local -a _command_args
    55  case "$words[1]" in
    56    build)
    57      __build ;;
    58    inspect)
    59      __inspect ;;
    60    push)
    61      __push ;;
    62    validate)
    63      __validate ;;
    64  esac