github.com/StackPointCloud/packer@v0.10.2-0.20180716202532-b28098e0f79b/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      '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    local -a build_arguments && build_arguments=(
    14      '-debug[Debug mode enabled for builds]'
    15      '-force[Force a build to continue if artifacts exist, deletes existing artifacts]'
    16      '-machine-readable[Machine-readable output]'
    17      '-except=[(foo,bar,baz) Build all builds other than these]'
    18      '-only=[(foo,bar,baz) Only build the given builds by name]'
    19      '-parallel=[(false) Disable parallelization (on by default)]'
    20      '-var[("key=value") Variable for templates, can be used multiple times.]'
    21      '-var-file=[(path) JSON file containing user variables.]'
    22      '(-)*:files:_files -g "*.json"'
    23    )
    24    
    25    local -a inspect_arguments && inspect_arguments=(
    26      '-machine-readable[Machine-readable output]' 
    27      '(-)*:files:_files -g "*.json"'
    28    )
    29  
    30    local -a push_arguments && push_arguments=(
    31      '-name=[(<name>) The destination build in Atlas.]'
    32      '-token=[(<token>) Access token to use to upload.]'
    33      '-var[("key=value") Variable for templates, can be used multiple times.]'
    34      '-var-file=[(path) JSON file containing user variables.]' 
    35      '(-)*:files:_files -g "*.json"'
    36    )
    37  
    38    local -a validate_arguments && validate_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      '(-)*:files:_files -g "*.json"'
    45    )
    46  
    47    _arguments -C \
    48      ':command:->command' \
    49      '*::options:->options'
    50  
    51    case $state in
    52        command)
    53          _describe -t commands 'command' sub_commands ;;
    54        options)
    55          case $line[1] in
    56            build)
    57              _arguments -s -S : $build_arguments ;;
    58            inspect)
    59              _arguments -s -S : $inspect_arguments ;;
    60            push)
    61              _arguments -s -S : $push_arguments ;;
    62            validate)
    63              _arguments -s -S : $validate_arguments ;;
    64          esac
    65        ;;
    66    esac
    67  }
    68  _packer "$@"