# phpbrew zsh completion script generated by CLIFramework
# Web: http://github.com/c9s/php-CLIFramework
# THIS IS AN AUTO-GENERATED FILE, PLEASE DON'T MODIFY THIS FILE DIRECTLY.
___phpbrewmeta () {
  local curcontext=$curcontext state line ret=1
  typeset -A opt_args
  typeset -A val_args
  declare -a lines
  declare -a args
  local ret=1
  local desc=$1
  local cmdsig=$2
  local valtype=$3
  local pos=$4
  local completion=$5
  output=$(phpbrew meta --zsh $cmdsig $valtype $pos $completion)
  lines=("${(@f)output}")
  output_type=${lines[1]}
  if [[ $lines[1] == "#groups" ]] ; then
      eval $output
      for tag in ${(k)groups} ; do
          complete_values=(${(z)${groups[$tag]}})
          label=${labels[$tag]}
          if [[ -z $label ]] ; then
              label=$tag
          fi
          _describe -t $tag $label complete_values && ret=0
      done
  elif [[ $lines[1] == "#values" ]] ; then
      args=(${lines:1})
     _values "$desc" ${=args} && ret=0
  elif [[ $lines[1] == "#descriptions" ]] ; then
      args=(${lines:1})
      _describe "$desc" args && ret=0
  else
     _values "$desc" ${=lines} && ret=0
  fi
  return ret
}
_phpbrew() {
local curcontext=$curcontext state line
typeset -A opt_args
local ret=1
  _arguments -C \
    '(-v --verbose)'{-v,--verbose}'[Print verbose message.]' \
    '(-d --debug)'{-d,--debug}'[Print debug message.]' \
    '(-q --quiet)'{-q,--quiet}'[Be quiet.]' \
    '(-h --help)'{-h,--help}'[Show help.]' \
    '--version[Show version.]' \
    '(-p --profile)'{-p,--profile}'[Display timing and memory usage information.]' \
    '--log-path[The path of a log file.]' \
    '--no-interact[Do not ask any interactive question.]' \
    '--no-progress[Do not display progress bar.]' \
    ': :->cmds' \
    '*:: :->option-or-argument' \
     && return
  case $state in
    (cmds)
  local commands; commands=(
    help:'Show help message of a command'
    zsh:'This function generate a zsh-completion script automatically'
    bash:'This command generate a bash completion script automatically'
    meta:'Return the meta data of a commands.'
    compile:'compile current source into Phar format library file.'
    archive:'Build executable phar file from composer.json'
    github:build-topics:'Build topic classes from the wiki of a GitHub Project.'
    init:'Initialize phpbrew config file.'
    known:'List known PHP versions'
    install:'Install php'
    list:'List installed PHPs'
    use:'Use php, switch version temporarily'
    switch:'Switch default php version.'
    each:'Iterate and run a given shell command over all php versions managed by PHPBrew.'
    config:'Edit your current php.ini in your favorite $EDITOR'
    info:'Show current PHP information'
    env:'Export environment variables'
    extension:'List extensions or execute extension subcommands'
    variants:'List php variants'
    path:'Show paths of the current PHP.'
    cd:'Change to directories'
    download:'Download php'
    clean:'Clean up the source directory of a PHP distribution'
    update:'Update PHP release source file'
    ctags:'Run ctags at current php source dir for extension development.'
    fpm:'fpm commands'
    list-ini:'List loaded ini config files.'
    self-update:'Self-update, default to master version'
    remove:'Remove installed php build.'
    purge:'Remove installed php version and config files.'
    off:'Temporarily go back to the system php'
    switch-off:'Definitely go back to the system php'
    system:'Get or set the internally used PHP binary'
    system-off:'Use the currently effective PHP binary internally'
  )
  _describe -t commands 'command' commands && ret=0
    ;;
    (option-or-argument)
      curcontext=${curcontext%:*}-$line[1]:
      case $line[1] in
        (help)
            _arguments -w -S -s \
              '--dev[Show development commands]' \
               && ret=0
        
        ;;
        (zsh)
            _arguments -w -S -s \
              '--bind=[bind complete to command]' \
              '--program=[programe name]' \
               && ret=0
        
        ;;
        (bash)
            _arguments -w -S -s \
              '--bind=[bind complete to command]' \
              '--program=[programe name]' \
               && ret=0
        
        ;;
        (meta)
            _arguments -w -S -s \
              '--flat[flat list format. work for both zsh and bash.]' \
              '--zsh[output for zsh]' \
              '--bash[output for bash]' \
              '--json[output in JSON format (un-implemented)]' \
              ':commandlist' \
              ':type' \
              ':arg' \
              ':attr' \
               && ret=0
        
        ;;
        (compile)
            _arguments -w -S -s \
              '--classloader[embed classloader source file]' \
              '--bootstrap[bootstrap or executable source file]' \
              '--executable[is a executable script ?]' \
              '--lib=[library path]' \
              '--include=[include path]' \
              '--exclude=[exclude pattern]' \
              '--output=[output]' \
              '(-c --compress)'{-c,--compress}'[phar file compress type\: gz, bz2]' \
              '--no-compress[do not compress phar file.]' \
               && ret=0
        
        ;;
        (archive)
            _arguments -w -S -s \
              '(-d --working-dir)'{-d,--working-dir=}'[If specified, use the given directory as working directory.]:dir:_directories' \
              '(-c --composer)'{-c,--composer=}'[The composer.json file. If --working-dir is ignored, dirname of the composer.json will be used.]:file:_files' \
              '--vendor=[Vendor directory name]' \
              '--bootstrap[bootstrap or executable php file]:file:_files' \
              '--executable[make the phar file executable]:boolean' \
              '--compress[compress type\: gz, bz2]::("gz" "bz2")' \
              '--no-compress[do not compress phar file.]' \
              '--add=[add a path respectively]' \
              '--exclude=[exclude pattern]' \
              '--no-classloader[do not embed a built-in classloader in the generated phar file.]' \
              '--app-bootstrap[Include CLIFramework bootstrap script.]' \
              ':phar-file' \
               && ret=0
        
        ;;
        (github:build-topics)
            _arguments -w -S -s \
              '--ns=[Class namespace]' \
              '--dir=[Output directory]' \
              '--update[Update wiki repository]' \
              ':user' \
              ':repo' \
               && ret=0
        
        ;;
        (init)
            _arguments -w -S -s \
              '(-c --config)'{-c,--config=}'[The YAML config file which should be copied into phpbrew home.The config file is used for creating custom virtual variants. For more details, please see https\://github.com/phpbrew/phpbrew/wiki/Setting-up-Configuration]:file:_files' \
              '--root=[Override the default PHPBREW_ROOT path setting.This option is usually used to load system-wide build pool. e.g. phpbrew init --root=/opt/phpbrew ]:dir:_directories' \
               && ret=0
        
        ;;
        (known)
            _arguments -w -S -s \
              '(-m --more)'{-m,--more}'[Show more older versions]' \
              '(-o --old)'{-o,--old}'[List old phps (less than 5.3)]' \
              '(-u --update)'{-u,--update}'[Update release list]' \
              '--downloader=[Use alternative downloader.]' \
              '--continue[Continue getting a partially downloaded file.]' \
              '--http-proxy=[HTTP proxy address]' \
              '--http-proxy-auth=[HTTP proxy authentication]' \
              '--connect-timeout=[Connection timeout]' \
               && ret=0
        
        ;;
        (install)
            _arguments -w -S -s \
              '--test[Run tests after the installation.]' \
              '--name=[The name of the installation. By default the installed path is equal to the release version name (php-5.x.x), however you can specify a custom name instead of the default `php-5.x.x`. For example, `myphp-5.3.2-dbg`]' \
              '--post-clean[Run make clean after the installation.]' \
              '--production[Use production configuration file. this installer will copy the php-production.ini into the etc directory.]' \
              '--build-dir=[Specify the build directory. the distribution tarball will be extracted to the directory you specified instead of $PHPBREW_ROOT/build/{name}.]:dir:_directories' \
              '--root[Specify PHPBrew root instead of PHPBREW_ROOT]' \
              '--home[Specify PHPBrew home instead of PHPBREW_HOME]' \
              '--no-config-cache[Do not use config.cache for configure script.]' \
              '--no-clean[Do not clean previously compiled objects before building PHP. By default phpbrew will run `make clean` before running the configure script to ensure everything is cleaned up.]' \
              '--no-patch[Do not apply any patch]' \
              '--no-configure[Do not run configure script]' \
              '--no-install[Do not install, just run build the target]' \
              '(-n --nice)'{-n,--nice=}'[Runs build processes at an altered scheduling priority. The priority can be adjusted over a range of -20 (the highest) to 20 (the lowest).]' \
              '--patch=[Apply patch before build.]:file:_files' \
              '--old[Install phpbrew incompatible phps (< 5.3)]' \
              '--user-config[Allow users create their own config file (php.ini or extension config init files)]' \
              '--downloader=[Use alternative downloader.]' \
              '--continue[Continue getting a partially downloaded file.]' \
              '--http-proxy=[HTTP proxy address]' \
              '--http-proxy-auth=[HTTP proxy authentication]' \
              '--connect-timeout=[Connection timeout]' \
              '(-f --force)'{-f,--force}'[Force the installation (redownloads source).]' \
              '(-d --dryrun)'{-d,--dryrun}'[Do not build, but run through all the tasks.]' \
              '--like=[Inherit variants from an existing build. This option would require an existing build directory from the {version}.]' \
              '(-j --jobs)'{-j,--jobs=}'[Specifies the number of jobs to run build simultaneously (make -jN).]' \
              '--stdout[Outputs install logs to stdout.]' \
              '--sudo[sudo to run install command.]' \
              ':version:{___phpbrewmeta "version" install arg 0 suggestions}' \
              '*:variants:{___phpbrewmeta "variants" install arg 1 suggestions}' \
               && ret=0
        
        ;;
        (list)
            _arguments -w -S -s \
              '(-d --dir)'{-d,--dir}'[Show php directories.]' \
              '(-v --variants)'{-v,--variants}'[Show used variants.]' \
               && ret=0
        
        ;;
        (use)
            _arguments -w -S -s \
              ':PHP version:{___phpbrewmeta "PHP version" use arg 0 valid-values}' \
               && ret=0
        
        ;;
        (switch)
            _arguments -w -S -s \
              ':PHP version:{___phpbrewmeta "PHP version" switch arg 0 valid-values}' \
               && ret=0
        
        ;;
        (each)
        
        ;;
        (config)
            _arguments -w -S -s \
              '(-s --sapi)'{-s,--sapi=}'[Edit php.ini for SAPI name.]:string' \
               && ret=0
        
        ;;
        (info)
        
        ;;
        (env)
            _arguments -w -S -s \
              ':PHP build:{___phpbrewmeta "PHP build" env arg 0 valid-values}' \
               && ret=0
        
        ;;
        (extension)
            _arguments -C \
              '(-so --show-options)'{-so,--show-options}'[Show extension configure options]' \
              '(-sp --show-path)'{-sp,--show-path}'[Show extension config.m4 path]' \
              ': :->cmds' \
              '*:: :->option-or-argument' \
               && return
            case $state in
              (cmds)
            local commands; commands=(
              enable:'Enable PHP extension'
              install:'Install PHP extension'
              disable:'Disable PHP extension'
              config:'Edit extension-specific configuration file'
              clean:'Clean up the compiled objects in the extension source directory.'
              show:'Show information of a PHP extension'
              known:'List known versions'
            )
            _describe -t commands 'command' commands && ret=0
              ;;
              (option-or-argument)
                curcontext=${curcontext%:*}-$line[1]:
                case $line[1] in
                  (enable)
                        _arguments -w -S -s \
                          '(-s --sapi)'{-s,--sapi=}'[Enable extension for SAPI name.]:string' \
                          ':extensions:{___phpbrewmeta "extensions" extension.enable arg 0 suggestions}' \
                           && ret=0
                  
                  ;;
                  (install)
                        _arguments -w -S -s \
                          '--pecl[Try to download from PECL even when ext source is bundled with php-src.]' \
                          '--redownload[Force to redownload extension source even if it is already available.]' \
                          '--downloader=[Use alternative downloader.]' \
                          '--continue[Continue getting a partially downloaded file.]' \
                          '--http-proxy=[HTTP proxy address]' \
                          '--http-proxy-auth=[HTTP proxy authentication]' \
                          '--connect-timeout=[Connection timeout]' \
                          ':extensions:{___phpbrewmeta "extensions" extension.install arg 0 suggestions}' \
                           && ret=0
                  
                  ;;
                  (disable)
                        _arguments -w -S -s \
                          '(-s --sapi)'{-s,--sapi=}'[Disable extension for SAPI name.]:string' \
                          ':extensions:{___phpbrewmeta "extensions" extension.disable arg 0 suggestions}' \
                           && ret=0
                  
                  ;;
                  (config)
                        _arguments -w -S -s \
                          '(-s --sapi)'{-s,--sapi=}'[Edit extension for SAPI name.]:string' \
                          ':extensions:{___phpbrewmeta "extensions" extension.config arg 0 suggestions}' \
                           && ret=0
                  
                  ;;
                  (clean)
                        _arguments -w -S -s \
                          '(-p --purge)'{-p,--purge}'[Remove all the source files.]' \
                          ':extensions:{___phpbrewmeta "extensions" extension.clean arg 0 suggestions}' \
                           && ret=0
                  
                  ;;
                  (show)
                        _arguments -w -S -s \
                          '--download[Download the extension source if extension not found.]' \
                          ':extension:{___phpbrewmeta "extension" extension.show arg 0 suggestions}' \
                           && ret=0
                  
                  ;;
                  (known)
                        _arguments -w -S -s \
                          '--downloader=[Use alternative downloader.]' \
                          '--continue[Continue getting a partially downloaded file.]' \
                          '--http-proxy=[HTTP proxy address]' \
                          '--http-proxy-auth=[HTTP proxy authentication]' \
                          '--connect-timeout=[Connection timeout]' \
                          ':extensions:{___phpbrewmeta "extensions" extension.known arg 0 suggestions}' \
                           && ret=0
                  
                  ;;
                esac
                ;;
              esac
        
        ;;
        (variants)
            _arguments -w -S -s \
              ':version' \
               && ret=0
        
        ;;
        (path)
            _arguments -w -S -s \
              ':type:("root" "home" "build" "bin" "include" "etc" "ext" "ext-src" "extension-src" "extension-dir" "config-scan" "dist")' \
               && ret=0
        
        ;;
        (cd)
            _arguments -w -S -s \
              ':directory:("var" "etc" "build" "dist")' \
               && ret=0
        
        ;;
        (download)
            _arguments -w -S -s \
              '(-f --force)'{-f,--force}'[Force extraction]' \
              '--old[enable old phps (less than 5.3)]' \
              '--downloader=[Use alternative downloader.]' \
              '--continue[Continue getting a partially downloaded file.]' \
              '--http-proxy=[HTTP proxy address]' \
              '--http-proxy-auth=[HTTP proxy authentication]' \
              '--connect-timeout=[Connection timeout]' \
              ':version:{___phpbrewmeta "version" download arg 0 suggestions}' \
               && ret=0
        
        ;;
        (clean)
            _arguments -w -S -s \
              '(-a --all)'{-a,--all}'[Remove all the files in the source directory of the PHP distribution.]' \
              ':PHP build:{___phpbrewmeta "PHP build" clean arg 0 valid-values}' \
               && ret=0
        
        ;;
        (update)
            _arguments -w -S -s \
              '(-o --old)'{-o,--old}'[List versions older than PHP 7.0]' \
              '--downloader=[Use alternative downloader.]' \
              '--continue[Continue getting a partially downloaded file.]' \
              '--http-proxy=[HTTP proxy address]' \
              '--http-proxy-auth=[HTTP proxy authentication]' \
              '--connect-timeout=[Connection timeout]' \
               && ret=0
        
        ;;
        (ctags)
            _arguments -w -S -s \
              ':PHP build:{___phpbrewmeta "PHP build" ctags arg 0 valid-values}' \
               && ret=0
        
        ;;
        (fpm)
            _arguments -C \
              ': :->cmds' \
              '*:: :->option-or-argument' \
               && return
            case $state in
              (cmds)
            local commands; commands=(
              restart:'Restart FPM server'
              setup:'Generate and setup FPM startup config'
              start:'Start FPM server'
              stop:'Stop FPM server'
            )
            _describe -t commands 'command' commands && ret=0
              ;;
              (option-or-argument)
                curcontext=${curcontext%:*}-$line[1]:
                case $line[1] in
                  (restart)
                  
                  ;;
                  (setup)
                        _arguments -w -S -s \
                          '--systemctl[Generate systemd service entry. This option only works for systemd-based Linux. To use this option, be sure to compile PHP with --with-fpm-systemd option. Start from 1.22, phpbrew automatically add --with-fpm-systemd when systemd is detected.]' \
                          '--initd[Generate init.d script. The generated init.d script depends on lsb-base >= 4.0. If initctl is based on upstart, the init.d script will not be executed. To check, please run /sbin/initctl --version in the command-line.]' \
                          '--launchctl[Generate plist for launchctl (OS X)]' \
                          '--stdout[Print config to STDOUT instead of writing to the file.]' \
                          ':buildName' \
                           && ret=0
                  
                  ;;
                  (start)
                  
                  ;;
                  (stop)
                  
                  ;;
                esac
                ;;
              esac
        
        ;;
        (list-ini)
        
        ;;
        (self-update)
            _arguments -w -S -s \
              '--downloader=[Use alternative downloader.]' \
              '--continue[Continue getting a partially downloaded file.]' \
              '--http-proxy=[HTTP proxy address]' \
              '--http-proxy-auth=[HTTP proxy authentication]' \
              '--connect-timeout=[Connection timeout]' \
               && ret=0
        
        ;;
        (remove)
            _arguments -w -S -s \
              ':installed php:{___phpbrewmeta "installed php" remove arg 0 valid-values}' \
               && ret=0
        
        ;;
        (purge)
            _arguments -w -S -s \
              '*:PHP build:{___phpbrewmeta "PHP build" purge arg 0 valid-values}' \
               && ret=0
        
        ;;
        (off)
        
        ;;
        (switch-off)
        
        ;;
        (system)
            _arguments -w -S -s \
              ':php version:{___phpbrewmeta "php version" system arg 0 suggestions}' \
               && ret=0
        
        ;;
        (system-off)
        
        ;;
      esac
      ;;
    esac

return ret
}
compdef _phpbrew phpbrew
