#compdef conan
# ------------------------------------------------------------------------------
# Copyright (c) 2010-2017 Github zsh-users - https://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above copyright
#       notice, this list of conditions and the following disclaimer in the
#       documentation and/or other materials provided with the distribution.
#     * Neither the name of the zsh-users nor the
#       names of its contributors may be used to endorse or promote products
#       derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
#  Completion script for conan 1.54.0 (https://conan.io).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
#  * Julien Nicoulaud <julien.nicoulaud@gmail.com>
#  * Shohei Yoshida <https://github.com/syohex>
#
# ------------------------------------------------------------------------------

_conan() {
  local context state state_descr line
  typeset -A opt_args

  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '(- : *)'{-v,--version}'[display version information]' \
    '(-h --help)1: :_conan_commands' \
    '(-h --help)*:: :->command_args'

  case $state in
    command_args)
      (( $+functions[_conan_${words[1]}_args] )) && _conan_${words[1]}_args
    ;;
  esac
}

(( $+functions[_conan_commands] )) ||
_conan_commands() {
  local consumer_commands creator_commands package_development_commands misc_commands deprecated_commands
  consumer_commands=(
    'install:installs the requirements specified in a "conanfile.py" or "conanfile.txt"'
    'config:manages conan configuration information'
    'get:gets a file or list a directory of a given reference or package'
    'info:prints information about a package recipe'\''s dependency graph'
    'search:search package recipes and binaries in the local cache or in a remote server'
  )
  creator_commands=(
    'new:creates a new package recipe template with a '\''conanfile.py'\'''
    'create:export, build package and test it with a consumer project'
    'upload:uploads a package recipe and the generated binary packages to a specified remote'
    'export:copies the package recipe (conanfile.py and associated files) to your local cache'
    'export-pkg:exports a recipe & creates a package with given files calling '\''package'\'''
    'test:runs a test-folder/conanfile.py to test an existing package'
  )
  package_development_commands=(
    'source:calls your conanfile.py "source()" method to configure the source directory'
    'build:utility command to run your current project "conanfile.py" build() method'
    'package:calls your conanfile.py "package" method for a specific package recipe'
    'editable:manages editable packages'
    'workspace:manages a workspace'
  )
  misc_commands=(
    'profile:list profiles in the ".conan/profiles" folder, or show profile details'
    'remote:handles the remote list and the package recipes associated to a remote'
    'user:update your cached user name (and auth token) to avoid it being requested later'
    'imports:execute the "imports" stage of a conanfile.txt or a conanfile.py'
    'copy:copy conan recipes and packages to another user/channel.'
    'remove:remove any package recipe or binary matching a pattern'
    'alias:creates and export an alias recipe'
    'download:Downloads conanfile attributes, like name, version, and options'
    'inspect:displays conanfile attributes like name, version, and options'
    'help:shows help for a specific command'
    'lock:generates and manipulates lock file'
    'frogarian:conan the frogarian'
  )

  _describe -t 'consumer-commands' "consumer commands" consumer_commands
  _describe -t 'creator-commands' "creator commands" creator_commands
  _describe -t 'package-development-commands' "package development commands" package_development_commands
  _describe -t 'misc-commands' "misc commands" misc_commands
}

(( $+functions[_conan_install_args] )) ||
_conan_install_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-g --generator)'{-g,--generator}'[Generators to use]: :_conan_generators' \
    '(-if --install-folder)'{-if,--install-folder}'[Use this directory as the directory where to put the generatorfiles]: :_files -/' \
    '(-of --output-folder)'{-of,--output-folder}'[The root output folder for generated and build files]: :_files -/' \
    '(-m --manifests)'{-m,--manifests}'[Install dependencies manifests in folder for later verify]:manifest' \
    '(-mi --manifests-interactive)'{-mi,--manifests-interactive}'[Install dependencies manifests in folder for later verify, asking user for confirmation]:manifests' \
    '(-v --verify)'{-v,--verify}'[Verify dependencies manifests against stored ones]:verify' \
    '--no-imports[Install specified packages but avoid running imports]' \
    '--build-require[The provided reference is a build-require]' \
    '(-j --json)'{-j,--json}'[Path to a json file where the install information will be written]: :_files -g "*.json"' \
    \*{-b,--build}'[Optional, specify which packages to build from source]:build' \
    '(-r --remote)'{-r,--remote}'[Look in the specified remote server]' \
    '(-u --update)'{-u,--update}'[Will check the remote and it will install those in the local cache]' \
    '(-l --lockfile)'{-l,--lockfile}'[Path to a lockfile]: :_files' \
    '--lockfile-out[Filename of the updated lockfile]: :_files' \
    \*{-e,--env}'[Environment variables that will be set during the package build(host machine)]:env' \
    \*{'-e\:b','--env\:build'}'[Environment variables that will be set during the package build(build machine)]:env' \
    \*{'-e\:h','--env\:host'}'[Environment variables that will be set during the package build(host machine)]:env' \
    \*{-o,--options}'[Define options values(host machine)]:option' \
    \*{'-o\:b','--options\:build'}'[Define options values(build machine)]:option' \
    \*{'-o\:h','--options\:host'}'[Define options values(host machine)]:option' \
    '(-pr --profile)'{-pr,--profile}'[Apply the specified profile to the host machine]: :_conan_profiles' \
    '(-pr\:b --profile\:build)'{-pr:b,--profile:build}'[Apply the specified profile to the build machine]: :_conan_profiles' \
    '(-pr\:h --profile\:host)'{-pr:h,--profile:host}'[Apply the specified profile to the host machine]: :_conan_profiles' \
    \*{-s,--settings}'[Settings to build the package, overwriting the defaults(host machine)]:setting' \
    \*{'-s\:b','--settings\:build'}'[Settings to build the package, overwriting the defaults(build machine)]:setting' \
    \*{'-s\:h','--settings\:host'}'[Settings to build the package, overwriting the defaults(host machine)]:setting' \
    \*{-c,--conf}'[Configuration to build the package overwriting the defaults(host machine)]:config' \
    \*{'-c\:b','--conf\:build'}'[Configuration to build the package overwriting the defaults(build machine)]:config' \
    \*{'-c\:h','--conf\:host'}'[Configuration to build the package overwriting the defaults(host machine)]:config' \
    '--lockfile-node-id[NodeID of the referenced package in the lockfile]:lockfile_node_id' \
    '--require-override[Define a requirement override]' \
    '1:config file:_files'
}

(( $+functions[_conan_config_args] )) ||
_conan_config_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-h --help)1: :_conan_config_commands' \
    '(-h --help)*:: :->command_args'

  case $state in
    command_args)
      (( $+functions[_conan_config_${words[1]}_args] )) && _conan_config_${words[1]}_args
    ;;
  esac
}

(( $+functions[_conan_config_commands] )) ||
_conan_config_commands() {
  local -a commands=(
    'get:get the value of existing element'
    'home:retrieve the Conan home directory'
    'install:install a full configuration from a zip file, local or remote'
    'rm:rm an existing config element'
    'set:set/add value'
    'init:initializes Conan configuration files'
    'list:list Conan configuration properties'
  )
  _describe -t 'commands' "command" commands
}

(( $+functions[_conan_config_get_args] )) ||
_conan_config_get_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '1: :_conan_config_keys'
}

(( $+functions[_conan_config_home_args] )) ||
_conan_config_home_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-j --json)'{-j,--json}'[json file path where the config home will be written to]: :_files -g "*.json"'
}

(( $+functions[_conan_config_install_args] )) ||
_conan_config_install_args() {
  _arguments \
    '(- : *)'{-h,--help}'[show help information]' \
    '--verify-ssl[Verify SSL connection when downloading file]: :(True False)' \
    '(-t --type)'{-t,--type}'[Type of remote config]: :(git dir file url)' \
    \*{-a,--args}'[String with extra arguments for "git clone"]:arg' \
    \*{-sf,--source-folder}'[Install files only from a source subfolder from specified origin]: :_files -/' \
    '(-tf --target-folder)'{-tf,--target-folder}'[Install to that path in the conan cache]: :_files -/' \
    '(-l --list)'{-l,--list}'[List stored configuration origins]' \
    \*{-r,--remove}'[Remove configuration origin by index in list]:remove' \
    '*:: :_files' \
}

(( $+functions[_conan_config_rm_args] )) ||
_conan_config_rm_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-h --help)1: :_conan_config_keys'
}

(( $+functions[_conan_config_set_args] )) ||
_conan_config_set_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-h --help)1: :_conan_config_set_key_values'
}

(( $+functions[_conan_config_set_key_values] )) ||
_conan_config_set_key_values() {
  local ret=1
  if compset -P '*='; then
    _wanted property-values expl 'config value' _conan_config_values ${IPREFIX%=} && ret=0
  else
    _wanted property-names expl 'config key' _conan_config_keys -qS= && ret=0
  fi
  return ret
}

(( $+functions[_conan_config_init_args] )) ||
_conan_config_init_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-h --help -f --force)'{-f,--force}'[overwrite existing Conan configuration files]'
}

(( $+functions[_conan_config_list_args] )) ||
_conan_config_list_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]'
}

(( $+functions[_conan_get_args] )) ||
_conan_get_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    "(-p --package)"{-p,--package}'[package ID]: :_conan_package_references' \
    '(-r --remote)'{-r,--remote}'[get from this specific remote]: :_conan_remotes' \
    '(-raw --raw)'{-raw,--raw}'[do not decorate the text]' \
    '1: :_conan_package_references' \
    '2:file or directory path:_files'
}

(( $+functions[_conan_info_args] )) ||
_conan_info_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '--paths[show package paths in local cache]' \
    '(-bo --build_order)'{-bo,--build_order}'[given a modified reference, return an ordered list to build (CI)]' \
    '(-g --graph)'{-g,--graph}'[creates file with project dependencies graph]: :_files -g "*.(dot|html)"' \
    '(-if --install-folder)'{-if,--install-folder}'[local folder containing the conaninfo.txt and conanbuildinfo.txt files]: :_files -/' \
    '(-j --json)'{-j,--json}'[only with --build_order option, return the information in a json]: :_files -g "*.json"' \
    '(-n --only)'{-n,--only}'[filter fields]: :_conan_info_only_values' \
    '--package-filter[print information only for packages that match the filtere.g., MyPackage/1.2@user/channel or MyPackage*]: :_conan_package_references' \
    '(-db --dry-build)'{-db,--dry-build}'[Apply the --build argument to output the information]:dry_build' \
    '(-f --file)'{-f,--file}'[specify conanfile filename]: :_conan_conanfiles' \
    '(-b --build)'{-b,--build}'[given a build policy (same install command "build" parameter), return an ordered list of packages that would be built from sources in install command (simulation)]: :_conan_build_policies' \
    '(-r --remote)'{-r,--remote}'[look in the specified remote server]: :_conan_remotes' \
    '(-u --update)'{-u,--update}'[check updates exist from upstream remotes]' \
    '(-l --lockfile)'{-l,--lockfile}'[Path to a lockfile]: :_files' \
    \*{-e,--env}'[Environment variables that will be set during the package build(host machine)]: :_conan_environment_variables' \
    \*{'-e\:b','--env\:build'}'[Environment variables that will be set during the package build(build machine)]: :_conan_environment_variables' \
    \*{'-e\:h','--env\:host'}'[Environment variables that will be set during the package build(host machine)]: :_conan_environment_variables' \
    \*{-o,--options}'[Define options values(host machine)]: :_conan_options' \
    \*{'-o\:b','--options\:build'}'[Define options values(build machine)]: :_conan_options' \
    \*{'-o\:h','--options\:host'}'[Define options values(host machine)]: :_conan_options' \
    '(-pr --profile)'{-pr,--profile}'[Apply the specified profile to the host machine]: :_conan_profiles' \
    '(-pr\:b --profile\:build)'{-pr:b,--profile:build}'[Apply the specified profile to the build machine]: :_conan_profiles' \
    '(-pr\:h --profile\:host)'{-pr:h,--profile:host}'[Apply the specified profile to the host machine]: :_conan_profiles' \
    \*{-s,--settings}'[Settings to build the package, overwriting the defaults(host machine)]: :_conan_settings' \
    \*{'-s\:b','--settings\:build'}'[Settings to build the package, overwriting the defaults(build machine)]: :_conan_settings' \
    \*{'-s\:h','--settings\:host'}'[Settings to build the package, overwriting the defaults(host machine)]: :_conan_settings' \
    \*{-c,--conf}'[Configuration to build the package, overwriting the defaults(host machine)]:conf' \
    \*{'-c\:b','--conf\:build'}'[Configuration to build the package, overwriting the defaults(build machine)]:conf' \
    \*{'-c\:h','--conf\:host'}'[Configuration to build the package, overwriting the defaults(host machine)]:conf' \
    '1: :_conan_conanfiles_or_package_references'
}

(( $+functions[_conan_search_args] )) ||
_conan_search_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-o --outdated)'{-o,--outdated}'[Show only outdated from recipe packages]' \
    '(-q --query)'{-q,--query}'[Packages query]:query' \
    '(-r --remote)'{-r,--remote}'[Remote to search in. "-r all" searches all remotes]:remote' \
    '--case-sensitive[Make a case-sensitive search]' \
    '--raw[Print just the list of recipes]' \
    '--table[Outputs html file with a table of binaries]: :_files' \
    '(-j --json)'{-j,--json}'[json file path where the search information will be written to]: :_files -g "*.json"' \
    '(-rev --revisions)'{-rev,--revisions}'[Get a list of versions for reference or a package reference]' \
    '1: :_conan_conanfiles_or_package_references'
}

(( $+functions[_conan_new_args] )) ||
_conan_new_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-t --test)'{-t,--test}'[create test_package skeleton to test package]' \
    '(-i --header)'{-i,--header}'[create a headers only package template]' \
    '(-c --pure-c)'{-c,--pure-c}'[create a C language package only package, deleting "self.settings.compiler.libcxx" setting in the configure method]' \
    '(-s --sources)'{-s,--sources}'[create a package with embedded sources in "src" folder, using "exports_sources" instead of retrieving external code with the "source()" method]' \
    '(-b --bare)'{-b,--bare}'[create the minimum package recipe, without build() or package() methods. Useful in combination with "package_files" command]' \
    '(-m --template)'{-m,--template}'[use the given template to generate a conan project]: :_files' \
    '(-cis --ci-shared)'{-cis,--ci-shared}'[package will have a "shared" option to be used in CI]' \
    '(-cilg --ci-travis-gcc)'{-cilg,--ci-travis-gcc}'[generate travis-ci files for linux gcc]' \
    '(-cilc --ci-travis-clang)'{-cilc,--ci-travis-clang}'[generate travis-ci files for linux clang]' \
    '(-cio --ci-travis-osx)'{-cio,--ci-travis-osx}'[generate travis-ci files for OSX apple-clang]' \
    '(-ciw --ci-appveyor-win)'{-ciw,--ci-appveyor-win}'[generate appveyor files for Appveyor Visual Studio]' \
    '(-ciglg --ci-gitlab-gcc)'{-ciglg,--ci-gitlab-gcc}'[generate GitLab files for linux gcc]' \
    '(-ciglc --ci-gitlab-clang)'{-ciglc,--ci-gitlab-clang}'[generate GitLab files for linux clang]' \
    '(-ciccg --ci-circleci-gcc)'{-ciccg,--ci-circleci-gcc}'[generate CircleCI files for linux gcc]' \
    '(-ciccc --ci-circleci-clang)'{-ciccc,--ci-circleci-clang}'[generate CircleCI files for linux clang]' \
    '(-cicco --ci-circleci-osx)'{-cicco,--ci-circleci-osx}'[generate CircleCI files for apple-clang]' \
    '(-gi --gitignore)'{-gi,--gitignore}'[generate a .gitignore with the known patterns to excluded]' \
    '(-ciu --ci-upload-url)'{-ciu,--ci-upload-url}'[define URL of the repository to upload]: :_urls' \
    \*{-d,--define}'[define]:define' \
    '1: :_conan_package_references'
}

(( $+functions[_conan_create_args] )) ||
_conan_create_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-j --json)'{-j,--json}'[json file path where the install information will be written to]: :_files -g "*.json"' \
    '(-k -ks --keep-source)'{-k,-ks,--keep-source}'[Do not remove the source folder in the local cache, even if the recipe changed]' \
    '(-kb --keep-build)'{-kb,--keep-build}'[Do not remove the build folder in local cache]' \
    '(-ne --not-export)'{-ne,--not-export}'[Do not export the conanfile.py]' \
    '(-tbf --test-build-folder)'{-tbf,--test-builder-folder}'[Working directory for the build of the test project]: :_files -/' \
    '(-tf --test-folder)'{-tf,--test-folder}'[Alternative test folder name]: :_files -/' \
    '--ignore-dirty[When using the "scm" feature with "auto" values]' \
    '--require-override[Define a requirement override]:require_override' \
    '(-m --manifests)'{-m,--manifests}'[Install dependencies manifests in folder for later verify]:manifests' \
    '(-mi --manifests-interactive)'{-mi,--manifests-interactive}'[Install dependencies manifests in folder for later verify, asking user for confirmation]:manifests' \
    '(-v --verify)'{-v,--verify}'[Verify dependencies manifests against stored ones]:verify' \
    '(-b --build)'{-b,--build}'[Optional, specify which packages to build from source]:build' \
    '(-r --remote)'{-r,--remote}'[Look in the specified remote server]:remote' \
    '(-u --update)'{-u,--update}'[Look in the specified remote server and it will install thoses in the local cache]' \
    '(-l --lockfile)'{-l,--lockfile}'[Path to a lockfile]: :_files' \
    '--lockfile-out[Filename of the updated lockfile]' \
    \*{-e,--env}'[Environment variables that will be set during the package build(host machine)]: :_conan_environment_variables' \
    \*{'-e\:b','--env\:build'}'[Environment variables that will be set during the package build(build machine)]: :_conan_environment_variables' \
    \*{'-e\:h','--env\:host'}'[Environment variables that will be set during the package build(host machine)]: :_conan_environment_variables' \
    \*{-o,--options}'[Define options values(host machine)]: :_conan_options' \
    \*{'-o\:b','--options\:build'}'[Define options values(build machine)]: :_conan_options' \
    \*{'-o\:h','--options\:host'}'[Define options values(host machine)]: :_conan_options' \
    '(-pr --profile)'{-pr,--profile}'[Apply the specified profile to the host machine]: :_conan_profiles' \
    '(-pr\:b --profile\:build)'{-pr:b,--profile:build}'[Apply the specified profile to the build machine]: :_conan_profiles' \
    '(-pr\:h --profile\:host)'{-pr:h,--profile:host}'[Apply the specified profile to the host machine]: :_conan_profiles' \
    \*{-s,--settings}'[Settings to build the package, overwriting the defaults(host machine)]: :_conan_settings' \
    \*{'-s\:b','--settings\:build'}'[Settings to build the package, overwriting the defaults(build machine)]: :_conan_settings' \
    \*{'-s\:h','--settings\:host'}'[Settings to build the package, overwriting the defaults(host machine)]: :_conan_settings' \
    \*{-c,--conf}'[Configuration to build the package, overwriting the defaults(host machine)]:conf' \
    \*{'-c\:b','--conf\:build'}'[Configuration to build the package, overwriting the defaults(build machine)]:conf' \
    \*{'-c\:h','--conf\:host'}'[Configuration to build the package, overwriting the defaults(host machine)]:conf' \
    '1: :_conan_package_references'
}

(( $+functions[_conan_upload_args] )) ||
_conan_upload_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-p --package)'{-p,--package}'[Package ID]:package' \
    '(-q --query)'{-q,--query}'[Only upload packages matching a specific query]:query' \
    '(-r --remote)'{-r,--remote}'[upload to this specific remote]:remote' \
    '--all[Upload both package recipe and packages]' \
    '--skip-upload[Do not upload anything, just run the checks and the compression]' \
    '--force[Ignore checks before uploading the recipe]' \
    '--check[Perform an integrity check, using the manifests, before upload]' \
    '(-c --confirm)'{-c,--confirm}'[Upload all matching recipes without confirmation]' \
    '--retry[In case of fail retries to upload again the specified times]:retry' \
    '--retry-wait[Waits specified seconds before retry again]:retry_wait' \
    '(-no --no-overwrite)'{-no,--no-overwrite}'[Uploads package only if recipe is the same as the remote one]:all_or_recipe' \
    '--parellel[Upload files in parallel using multiple threads]' \
    '1: :_conan_package_references'
}

(( $+functions[_conan_export_args] )) ||
_conan_export_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-k -ks --keep-source)'{-k,-ks,--keep-source}'[do not remove the source folder in the local cache]' \
    '(-l --lockfile)'{-l,--lockfile}'[Path to a lockfile file]: :_files' \
    '--lockfile-out[Filename of the updated lockfile]: :_files' \
    '--ignore-dirty[When using the "scm" feature with "auto" values]' \
    '1: :_conan_channel_or_package_references'
}

(( $+functions[_conan_export-pkg_args] )) ||
_conan_export-pkg_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-b --build-folder)'{-b,--build-folder}'[Directory for the build process]: :_files -/' \
    '(-f --force)'{-f,--force}'[Overwrite existing package if existing]' \
    '(-if --install-folder)'{-if,--install-folder}'[Directory containing the conaninfo.txt and conanbuildinfo.txt files]: :_files -/' \
    '(-pf --package-folder)'{-pf,--package-folder}'[folder containing a locally created package]: :_files -/' \
    '(-sf --source-folder)'{-sf,--source-folder}'[Directory containing the sources]: :_files -/' \
    '(-j --json)'{-j,--json}'[Path to a json file where the install information will be written]: :_files -g "*.json"' \
    '(-l --lockfile)'{-l,--lockfile}'[Path to a lockfile file]: :_files' \
    '--lockfile-out[Filename of the updated lockfile]: :_files' \
    '--ignore-dirty[When using the "scm" feature with "auto" values]' \
    \*{-e,--env}'[Environment variables that will be set during the package build(host machine)]: :_conan_environment_variables' \
    \*{'-e\:b','--env\:build'}'[Environment variables that will be set during the package build(build machine)]: :_conan_environment_variables' \
    \*{'-e\:h','--env\:host'}'[Environment variables that will be set during the package build(host machine)]: :_conan_environment_variables' \
    \*{-o,--options}'[Define options values(host machine)]: :_conan_options' \
    \*{'-o\:b','--options\:build'}'[Define options values(build machine)]: :_conan_options' \
    \*{'-o\:h','--options\:host'}'[Define options values(host machine)]: :_conan_options' \
    '(-pr --profile)'{-pr,--profile}'[Apply the specified profile to the host machine]: :_conan_profiles' \
    '(-pr\:b --profile\:build)'{-pr:b,--profile:build}'[Apply the specified profile to the build machine]: :_conan_profiles' \
    '(-pr\:h --profile\:host)'{-pr:h,--profile:host}'[Apply the specified profile to the host machine]: :_conan_profiles' \
    \*{-s,--settings}'[Settings to build the package, overwriting the defaults(host machine)]: :_conan_settings' \
    \*{'-s\:b','--settings\:build'}'[Settings to build the package, overwriting the defaults(build machine)]: :_conan_settings' \
    \*{'-s\:h','--settings\:host'}'[Settings to build the package, overwriting the defaults(host machine)]: :_conan_settings' \
    \*{-c,--conf}'[Configuration to build the package, overwriting the defaults(host machine)]:conf' \
    \*{'-c\:b','--conf\:build'}'[Configuration to build the package, overwriting the defaults(build machine)]:conf' \
    \*{'-c\:h','--conf\:host'}'[Configuration to build the package, overwriting the defaults(host machine)]:conf' \
    '1: :_conan_channel_or_package_references'
}

(( $+functions[_conan_test_args] )) ||
_conan_test_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-tbf --test-build-folder)'{-tbf,--test-builder-folder}'[Working directory for the build of the test project]: :_files -/' \
    '(-b --build)'{-b,--build}'[Optional, specify which packages to build from source]:build' \
    '(-r --remote)'{-r,--remote}'[Look in the specified remote server]:remote' \
    '(-l --lockfile)'{-l,--lockfile}'[Path to a lockfile]: :_files' \
    '--lockfile-out[Filename of the updated lockfile]' \
    \*{-e,--env}'[Environment variables that will be set during the package build(host machine)]: :_conan_environment_variables' \
    \*{'-e\:b','--env\:build'}'[Environment variables that will be set during the package build(build machine)]: :_conan_environment_variables' \
    \*{'-e\:h','--env\:host'}'[Environment variables that will be set during the package build(host machine)]: :_conan_environment_variables' \
    \*{-o,--options}'[Define options values(host machine)]: :_conan_options' \
    \*{'-o\:b','--options\:build'}'[Define options values(build machine)]: :_conan_options' \
    \*{'-o\:h','--options\:host'}'[Define options values(host machine)]: :_conan_options' \
    '(-pr --profile)'{-pr,--profile}'[Apply the specified profile to the host machine]: :_conan_profiles' \
    '(-pr\:b --profile\:build)'{-pr:b,--profile:build}'[Apply the specified profile to the build machine]: :_conan_profiles' \
    '(-pr\:h --profile\:host)'{-pr:h,--profile:host}'[Apply the specified profile to the host machine]: :_conan_profiles' \
    \*{-s,--settings}'[Settings to build the package, overwriting the defaults(host machine)]: :_conan_settings' \
    \*{'-s\:b','--settings\:build'}'[Settings to build the package, overwriting the defaults(build machine)]: :_conan_settings' \
    \*{'-s\:h','--settings\:host'}'[Settings to build the package, overwriting the defaults(host machine)]: :_conan_settings' \
    \*{-c,--conf}'[Configuration to build the package, overwriting the defaults(host machine)]:conf' \
    \*{'-c\:b','--conf\:build'}'[Configuration to build the package, overwriting the defaults(build machine)]:conf' \
    \*{'-c\:h','--conf\:host'}'[Configuration to build the package, overwriting the defaults(host machine)]:conf' \
    '1: :_conan_package_references'
}

(( $+functions[_conan_source_args] )) ||
_conan_source_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-sf --source-folder)'{-sf,--source-folder}'[Destination directory. Defaulted to current directory]: :_files -/' \
    '(-if --install-folder)'{-if,--install-folder}'[Directory containing the conaninfo.txt and conanbuildinfo.txt files]: :_files -/' \
    '*: :_files'
}

(( $+functions[_conan_build_args] )) ||
_conan_build_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-b --build)'{-b,--build}'[Execute the build step]' \
    "(-bf --build-folder)"{-bf,--build-folder}'[build folder, working directory of the build process. Defaulted to the current directory. A relative path can also be specified (relative to the current directory)]: :_files -/' \
    '(-c --configure)'{-c,--configure}'[Execute the configuration step]' \
    '(-i --install)'{-i,--install}'[Execute the install step]' \
    '(-t --test)'{-t,--test}'[Execute the test step]' \
    "(-if --install-folder)"{-if,--install-folder}'[local folder containing the conaninfo.txt and conanbuildinfo.txt files (from a previous conan install execution). Defaulted to --build-folder]: :_files -/' \
    "(-pf --package-folder)"{-pf,--package-folder}'[folder to install the package (when the build system or build() method does it). Defaulted to the '\''{build_folder}/package'\'' folder. A relative path can be specified, relative to the current folder. Also an absolute path is allowed.]: :_files -/' \
     "(-sf --source-folder)"{-sf,--source-folder}'[local folder containing the sources. Defaulted to the directory of the conanfile. A relative path can also be specified (relative to the current directory)]: :_files -/' \
    '1: :_files'
}

(( $+functions[_conan_package_args] )) ||
_conan_package_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    "(-bf --build-folder)"{-bf,--build-folder}'[build folder, working directory of the build process. Defaulted to the current directory. A relative path can also be specified (relative to the current directory)]: :_files -/' \
    "(-if --install-folder)"{-if,--install-folder}'[local folder containing the conaninfo.txt and conanbuildinfo.txt files (from a previous conan install execution). Defaulted to --build-folder]: :_files -/' \
    "(-pf --package-folder)"{-pf,--package-folder}'[folder to install the package (when the build system or build() method does it). Defaulted to the '\''{build_folder}/package'\'' folder. A relative path can be specified, relative to the current folder. Also an absolute path is allowed.]: :_files -/' \
    '1: :_conan_package_references' \
    "(-sf --source-folder)"{-sf,--source-folder}'[local folder containing the sources. Defaulted to the directory of the conanfile. A relative path can also be specified (relative to the current directory)]: :_files -/' \
    '2:package ID:'
}

(( $+functions[_conan_editable_args] )) ||
_conan_editable_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '1: :_conan_editable_commands' \
    '*:: :->command_args'

  case $state in
    command_args)
      (( $+functions[_conan_editable_${words[1]}_args] )) && _conan_editable_${words[1]}_args
    ;;
  esac
}

(( $+functions[_conan_editable_commands] )) ||
_conan_editable_commands() {
  local -a commands=(
    'add:Put a package in editable mode'
    'remove:Disable editable mode for a package'
    'list:List packages in editable mode'
  )
  _describe -t 'commands' "command" commands
}

(( $+functions[_conan_editable_add_args] )) ||
_conan_editable_add_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-l --layout)'{-l,--layout}'[Relative or absolute path to a file containing the layout]: :_files' \
    '(-of --output)'{-of,--output-folder}'[The root output folder for generated and build files]: :_files -/' \
    '*: :_files'
}

(( $+functions[_conan_editable_remove_args] )) ||
_conan_editable_remove_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '*: :_conan_package_references'
}

(( $+functions[_conan_editable_list_args] )) ||
_conan_editable_list_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]'
}

(( $+functions[_conan_workspace_args] )) ||
_conan_workspace_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '1: :_conan_workspace_commands' \
    '*:: :->command_args'

  case $state in
    command_args)
      (( $+functions[_conan_workspace_${words[1]}_args] )) && _conan_workspace_${words[1]}_args
    ;;
  esac
}

(( $+functions[_conan_workspace_commands] )) ||
_conan_workspace_commands() {
  local -a commands=(
    'install:same as a "conan install" command but using the workspace data from the file'
  )
  _describe -t 'commands' "command" commands
}

(( $+functions[_conan_workspace_install_args] )) ||
_conan_workspace_install_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-b --build)'{-b,--build}'[Optional, specify which packages to build from source]:build' \
    '(-r --remote)'{-r,--remote}'[Look in the specified remote server]:remote' \
    '(-u --update)'{-u,--update}'[Will check the remote and it will install thoses in the local cache]' \
    '(-l --lockfile)'{-l,--lockfile}'[Path to a lockfile]: :_files' \
    '--lockfile-out[Filename of the updated lockfile]' \
    \*{-e,--env}'[Environment variables that will be set during the package build(host machine)]: :_conan_environment_variables' \
    \*{'-e\:b','--env\:build'}'[Environment variables that will be set during the package build(build machine)]: :_conan_environment_variables' \
    \*{'-e\:h','--env\:host'}'[Environment variables that will be set during the package build(host machine)]: :_conan_environment_variables' \
    \*{-o,--options}'[Define options values(host machine)]: :_conan_options' \
    \*{'-o\:b','--options\:build'}'[Define options values(build machine)]: :_conan_options' \
    \*{'-o\:h','--options\:host'}'[Define options values(host machine)]: :_conan_options' \
    '(-pr --profile)'{-pr,--profile}'[Apply the specified profile to the host machine]: :_conan_profiles' \
    '(-pr\:b --profile\:build)'{-pr:b,--profile:build}'[Apply the specified profile to the build machine]: :_conan_profiles' \
    '(-pr\:h --profile\:host)'{-pr:h,--profile:host}'[Apply the specified profile to the host machine]: :_conan_profiles' \
    \*{-s,--settings}'[Settings to build the package, overwriting the defaults(host machine)]: :_conan_settings' \
    \*{'-s\:b','--settings\:build'}'[Settings to build the package, overwriting the defaults(build machine)]: :_conan_settings' \
    \*{'-s\:h','--settings\:host'}'[Settings to build the package, overwriting the defaults(host machine)]: :_conan_settings' \
    \*{-c,--conf}'[Configuration to build the package, overwriting the defaults(host machine)]:conf' \
    \*{'-c\:b','--conf\:build'}'[Configuration to build the package, overwriting the defaults(build machine)]:conf' \
    \*{'-c\:h','--conf\:host'}'[Configuration to build the package, overwriting the defaults(host machine)]:conf' \
    '(-if --install-folder)'{-if,--install-folder}'[Folder where the workspace files will be created]: :_files -/' \
    '*: :_files'
}

(( $+functions[_conan_profile_args] )) ||
_conan_profile_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1: :_conan_profile_commands' \
    '*:: :->command_args'

  case $state in
    command_args)
      (( $+functions[_conan_profile_${words[1]}_args] )) && _conan_profile_${words[1]}_args
    ;;
  esac
}

(( $+functions[_conan_profile_commands] )) ||
_conan_profile_commands() {
  local -a commands=(
    'list:list current profiles'
    'show:show the values defined for a profile'
    'new:creates a new empty profile'
    'update:update a profile'
    'get:get a profile key'
    'remove:remove a profile key'
  )
  _describe -t 'commands' "command" commands
}

(( $+functions[_conan_profile_list_args] )) ||
_conan_profile_list_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-j --json)'{-j,--json}'[json file path where the profile list will be written to]: :_files -g "*.json"'
}

(( $+functions[_conan_profile_show_args] )) ||
_conan_profile_show_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1: :_conan_profiles'
}

(( $+functions[_conan_profile_new_args] )) ||
_conan_profile_new_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '--detect[autodetect settings and fill \[settings\] section]' \
    '--force[Overwrite existing profile if existing]' \
    '1:profile name:'
}

(( $+functions[_conan_profile_update_args] )) ||
_conan_profile_update_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1: :_conan_settings' \
    '2: :_conan_profiles'
}

(( $+functions[_conan_profile_get_args] )) ||
_conan_profile_get_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1: :_conan_setting_keys' \
    '2: :_conan_profiles'
}

(( $+functions[_conan_profile_remove_args] )) ||
_conan_profile_remove_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1: :_conan_setting_keys' \
    '2: :_conan_profiles'
}

(( $+functions[_conan_remote_args] )) ||
_conan_remote_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-h --help)1: :_conan_remote_commands' \
    '(-h --help)*:: :->command_args'

  case $state in
    command_args)
      (( $+functions[_conan_remote_${words[1]}_args] )) && _conan_remote_${words[1]}_args
    ;;
  esac
}

(( $+functions[_conan_remote_commands] )) ||
_conan_remote_commands() {
  local -a commands=(
    'list:list current remotes'
    'add:add a remote'
    'remove:remove a remote'
    'update:update the remote url'
    'rename:Update the remote name'
    'list_ref:list the package recipes and its associated remotes'
    'add_ref:associate a recipe'\''s reference to a remote'
    'remove_ref:dissociate a recipe'\''s reference and its remote'
    'update_ref:update the remote associated with a package recipe'
    'list_pref:list the package binaries and its associated remotes'
    'add_pref:associate a package reference to a remote'
    'remove_pref:dissociate a package reference to a remote'
    'update_pref:update the remote associated with a binary package'
    'clean:clean the list of remotes and all recipe-remote associations'
    'enable:enable a remote'
    'disable:disable a remote'
  )
  _describe -t 'commands' "command" commands
}

(( $+functions[_conan_remote_list_args] )) ||
_conan_remote_list_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-raw --raw)'{-raw,--raw}'[Raw format]'
}

(( $+functions[_conan_remote_add_args] )) ||
_conan_remote_add_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-i --insert)'{-i,--insert}'[insert remote at specific index]:index' \
    '(-f --force)'{-f,--force}'[Force addition, will update if existing]' \
    '1:name of the remote:' \
    '2:url of the remote:_urls' \
    '3:verify SSL certificated:(True False)'
}

(( $+functions[_conan_remote_remove_args] )) ||
_conan_remote_remove_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1: :_conan_remotes'
}

(( $+functions[_conan_remote_update_args] )) ||
_conan_remote_update_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-i --insert)'{-i,--insert}'[insert remote at specific index]:index' \
    '1: :_conan_remotes' \
    '2:url of the remote:_urls' \
    '3:verify SSL certificated:(True False)'
}

(( $+functions[_conan_remote_rename_args] )) ||
_conan_remote_rename_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1: :_conan_remotes' \
    '2: :_conan_remotes'
}

(( $+functions[_conan_remote_list_ref_args] )) ||
_conan_remote_list_ref_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '--no-remote[List the ones without remote]'
}

(( $+functions[_conan_remote_add_ref_args] )) ||
_conan_remote_add_ref_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1:reference:_conan_package_references' \
    '2:remote:_conan_remotes'
}

(( $+functions[_conan_remote_remove_ref_args] )) ||
_conan_remote_remove_ref_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1:reference:_conan_package_references'
}

(( $+functions[_conan_remote_update_ref_args] )) ||
_conan_remote_update_ref_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1:reference:_conan_package_references' \
    '2:remove:_conan_remotes'
}

(( $+functions[_conan_remote_list_pref_args] )) ||
_conan_remote_list_pref_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '--no-remote[List the ones without remote]' \
    '1:reference:_conan_package_references'
}

(( $+functions[_conan_remote_add_pref_args] )) ||
_conan_remote_add_pref_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1:reference:_conan_package_references' \
    '2: :_conan_remotes'
}

(( $+functions[_conan_remote_remove_pref_args] )) ||
_conan_remote_remove_pref_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1:reference:_conan_package_references'
}

(( $+functions[_conan_remote_update_pref_args] )) ||
_conan_remote_update_pref_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1:reference:_conan_package_references' \
    '2: :_conan_remotes'
}

(( $+functions[_conan_user_args] )) ||
_conan_user_args() {
  _arguments  \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-c --clean)'{-c,--clean}'[Remove user and tokens for all remotes]' \
    '(-p --password)'{-p,--password}'[User password]:password' \
    '(-r --remote)'{-r,--remote}'[Use the specified remote server]: :_conan_remotes' \
    '(-j --json)'{-j,--json}'[json file path where the user list will be written to]: :_files -g "*.json"' \
    '1::name_name'
}

(( $+functions[_conan_imports_args] )) ||
_conan_imports_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-if --install-folder)'{-if,--install-folder}'[local folder containing the conaninfo.txt and conanbuildinfo.txt files (from a previous conan install execution)]: :_files -/' \
    '(-imf --import-folder)'{-imf,--import-folder}'[directory to copy the artifacts to. By default it will be the current directory]: :_files -/' \
    '(-u --undo)'{-u,--undo}'[undo imports (remove imported files)]' \
    '1: :_conan_directory_or_package_references'
}

(( $+functions[_conan_copy_args] )) ||
_conan_copy_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    "(--all -p --package)"{-p,--package}'[copy specified package ID]:package reference:_conan_package_references' \
    '(--all -p --package)--all[copy all packages from the specified package recipe]' \
    '(--force)--force[override destination packages and the package recipe]' \
    '1: :_conan_package_references' \
    '2: :_conan_user_channels'
}

(( $+functions[_conan_remove_args] )) ||
_conan_remove_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-b --builds)'{-b,--builds}'[By default, remove all the build folders or select one]::package_id' \
    '(-f --force)'{-f,--force}'[Remove without requesting a confirmation]' \
    '(-l --locks)'{-l,--locks}'[Remove locks]' \
    '(-o --outdated)'{-o,--outdated}'[Remove only outdated from recipe packages]' \
    \*{-p,--packages}'[Remove all packages of the specified reference]:package_id' \
    '(-q --query)'{-q,--query}'[Package query]:query' \
    '(-r --remote)'{-r,--remote}'[Will remove from the specified remote]: :_conan_remotes' \
    '(-s --src)'{-s,--src}'[Remove source folders]' \
    '(-t --system-reqs)'{-t,--system-reqs}'[Remove system_reqs folder]' \
    '*: :_conan_package_references'
}

(( $+functions[_conan_alias_args] )) ||
_conan_alias_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1:alias reference:_conan_package_references' \
    '2:target reference:_conan_package_references'
}

(( $+functions[_conan_download_args] )) ||
_conan_download_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-p --package)'{-p,--package}'[Force install specified package ID]:package_id' \
    '(-r --remote)'{-r,--remote}'[Will remove from the specified remote]: :_conan_remotes' \
    '(-re --recipe)'{-re,--recipe}'[Downloads only the recipe]' \
    '*: :_conan_package_references' \
}

(( $+functions[_conan_inspect_args] )) ||
_conan_inspect_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    \*{-a,--attribute}'[The attribute to be displayed]' \
    '(-r --remote)'{-r,--remote}'[Will remove from the specified remote]: :_conan_remotes' \
    '(-j --json)'{-j,--json}'[json output file]: :_files -g "*.json"' \
    '*--raw[Print just the value of the requested attribute]:attribute' \
    '*: :_conan_package_references' \
}

(( $+functions[_conan_lock_args] )) ||
_conan_lock_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-h --help)1: :_conan_lock_commands' \
    '(-h --help)*:: :->command_args'

  case $state in
    command_args)
      (( $+functions[_conan_lock_${words[1]}_args] )) && _conan_lock_${words[1]}_args
    ;;
  esac
}

(( $+functions[_conan_lock_commands] )) ||
_conan_lock_commands() {
  local -a commands=(
    'update:Complete missing information in the first lockfile with information defined in the second lockfile'
    'build-order:Returns build-order'
    'clean-modified:Clean modified flags'
    'install:Install a lockfile'
    'create:Create a lockfile from a conanfile or a reference'
    'bundle:Manages lockfile bundles'
  )
  _describe -t 'commands' "command" commands
}

(( $+functions[_conan_lock_update_args] )) ||
_conan_lock_update_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '1:old_lockfile:_files' \
    '2:new_lockfile:_files'
}

(( $+functions[_conan_lock_build-order_args] )) ||
_conan_lock_build-order_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '--json[generate output file in json format]: :_files -g "*.json"' \
    '*:lockfile:_files'
}

(( $+functions[_conan_lock_clean-modified_args] )) ||
_conan_lock_clean-modified_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '*:lockfile:_files'
}

(( $+functions[_conan_lock_install_args] )) ||
_conan_lock_install_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '--recipes[Install only recipes, not binaries]' \
    '(-g --generator)'{-g,--generator}'[Generators to use]:_conan_generators' \
    '*:lockfile:_files'
}

(( $+functions[_conan_lock_create_args] )) ||
_conan_lock_create_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '--name[Provide a package name if not specified in conanfile]:name' \
    '--version[Provide a package version if not specified in conanfile]:version' \
    '--user[Provide a user]:user' \
    '--channel[Provide a channel]:channel' \
    '--reference[Provide a package reference instead of a conanfile]: :_conan_package_references' \
    '(-l --lockfile)'{-l,--lockfile}'[Path to a lockfile]: :_files' \
    '--base[Lock only recipe versions and revisions]' \
    '--lockfile-out[Filename of the updated lockfile]: :_files' \
    '(-r --remote)'{-r,--remote}'[Look in the specified remote server]:remote' \
    '(-u --update)'{-u,--update}'[Will check the remote and it will install thoses in the local cache]' \    \*{-e,--env}'[Environment variables that will be set during the package build(host machine)]:env' \
    \*{'-e\:b','--env\:build'}'[Environment variables that will be set during the package build(build machine)]:env' \
    \*{'-e\:h','--env\:host'}'[Environment variables that will be set during the package build(host machine)]:env' \
    \*{-o,--options}'[Define options values(host machine)]:option' \
    \*{'-o\:b','--options\:build'}'[Define options values(build machine)]:option' \
    \*{'-o\:h','--options\:host'}'[Define options values(host machine)]:option' \
    '(-pr --profile)'{-pr,--profile}'[Apply the specified profile to the host machine]: :_conan_profiles' \
    '(-pr\:b --profile\:build)'{-pr:b,--profile:build}'[Apply the specified profile to the build machine]: :_conan_profiles' \
    '(-pr\:h --profile\:host)'{-pr:h,--profile:host}'[Apply the specified profile to the host machine]: :_conan_profiles' \
    \*{-s,--settings}'[Settings to build the package, overwriting the defaults(host machine)]:setting' \
    \*{'-s\:b','--settings\:build'}'[Settings to build the package, overwriting the defaults(build machine)]:setting' \
    \*{'-s\:h','--settings\:host'}'[Settings to build the package, overwriting the defaults(host machine)]:setting' \
    \*{-c,--conf}'[Configuration to build the package overwriting the defaults(host machine)]:config' \
    \*{'-c\:b','--conf\:build'}'[Configuration to build the package overwriting the defaults(build machine)]:config' \
    \*{'-c\:h','--conf\:host'}'[Configuration to build the package overwriting the defaults(host machine)]:config' \
    '*:lockfile:_files'
}

(( $+functions[_conan_lock_bundle_args] )) ||
_conan_lock_bundle_args() {
  _arguments -C \
    '(- : *)'{-h,--help}'[display help information]' \
    '(-h --help)1: :_conan_lock_bundle_commands' \
    '(-h --help)*:: :->command_args'

  case $state in
    command_args)
      (( $+functions[_conan_lock_bundle_${words[1]}_args] )) && _conan_lock_bundle_${words[1]}_args
    ;;
  esac
}

(( $+functions[_conan_lock_bundle_commands] )) ||
_conan_lock_bundle_commands() {
  local -a commands=(
    'create:Create lockfile bundle'
    'build-order:Return build-order'
    'update:Update both the bundle information as well as every individual lockfile'
    'clean-modified:Clean modified flag'
  )
  _describe -t 'commands' "command" commands
}

(( $+functions[_conan_lock_bundle_create_args] )) ||
_conan_lock_bundle_create_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '--bundle-out[Filename of the created bundle]: :_files' \
    '*:lockfile:_files' \
}

(( $+functions[_conan_lock_bundle_build-order_args] )) ||
_conan_lock_bundle_build-order_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '--json[generate output file in json format]: :_files -g "*.json"' \
    '*:bundle:_files' \
}

(( $+functions[_conan_lock_bundle_update_args] )) ||
_conan_lock_bundle_update_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '*:bundle:_files' \
}

(( $+functions[_conan_lock_bundle_clean-modified_args] )) ||
_conan_lock_bundle_clean-modified_args() {
  _arguments \
    '(- : *)'{-h,--help}'[display help information]' \
    '*:bundle:_files' \
}

(( $+functions[_conan_generators] )) ||
_conan_generators() {
  local -a generators=(cmake cmake_multi cmake_paths cmake_find_package cmake_find_package_multi
                       msbuild visual_studio visual_studio_multi visual_studio_legacy xcode compiler_args gcc
                       boost-build b2 qbs qmake scons pkg_config virtualenv virtualenv_python virtualbuildenv
                       virtualrunenv youcompleteme txt json premake make markdown deploy)

  _values "generator" $generators
}

(( $+functions[_conan_info_only_values] )) ||
_conan_info_only_values() {
  local -a values=(
    'id:show only "id"'
    'build_id:show only "build_id"'
    'remote:show only "remote"'
    'url:show only "url"'
    'license:show only "license"'
    'requires:show only "requires"'
    'update:show only "update"'
    'required:show only "required"'
    'date:show only "date"'
    'author:show only "author"'
    'export_folder:use with --paths'
    'build_folder:use with --paths'
    'package_folder:use with --paths'
    'source_folder:use with --paths'
    'None:show only references'
  )
  _describe -t 'values' "value" values
}

(( $+functions[_conan_conanfiles] )) ||
_conan_conanfiles() {
  _files -g '*.py'
}

(( $+functions[_conan_conanfiles_or_package_references] )) ||
_conan_conanfiles_or_package_references() {
  _alternative \
    'conanfile: :_conan_conanfiles' \
    'package-references: :_conan_package_references'
}

(( $+functions[_conan_directory_or_package_references] )) ||
_conan_directory_or_package_references() {
  _alternative \
    'directory: :_files -/' \
    'package-references: :_conan_package_references'
}

(( $+functions[_conan_channel_or_package_references] )) ||
_conan_channel_or_package_references() {
  _alternative \
    'package-references: :_conan_package_references' \
    'user-channels: :_conan_user_channels'
}

(( $+functions[_conan_package_references] )) ||
_conan_package_references() {
  _guard '[^\-]#' 'package reference'  # TODO complete package references
}

(( $+functions[_conan_user_channels] )) ||
_conan_user_channels() {
  _guard '[^\-]#' 'user channel' # TODO complete user channels
}

(( $+functions[_conan_remotes] )) ||
_conan_remotes() {
  local remotes; remotes=(${(f)"$(_call_program remotes $service remote list)"})
  _describe -t remotes 'remote' remotes "$@"
}

(( $+functions[_conan_scopes] )) ||
_conan_scopes() {
  _guard '[^\-]#' 'scope' # TODO complete scopes
}

(( $+functions[_conan_build_policies] )) ||
_conan_build_policies() {
  _guard '[^\-]#' 'build policy' # TODO complete build policies
}

(( $+functions[_conan_profiles] )) ||
_conan_profiles() {
  local profiles; profiles=(${(f)"$(_call_program profiles $service profile list)"})
  _describe -t profiles 'profile' profiles "$@"
}

(( $+functions[_conan_config_keys] )) ||
_conan_config_keys() {
  _guard '[^\-]#' 'config key' # TODO complete config keys
}

(( $+functions[_conan_config_values] )) ||
_conan_config_values() {
  _guard '[^\-]#' 'config value' # TODO complete config values
}

(( $+functions[_conan_options] )) ||
_conan_options() {
  local ret=1
  if compset -P '*='; then
    _wanted option-values expl 'option value' _conan_option_values ${IPREFIX%=} && ret=0
  else
    _wanted option-names expl 'option key' _conan_option_keys -qS= && ret=0
  fi
  return ret
}

(( $+functions[_conan_option_keys] )) ||
_conan_option_keys() {
  _guard '[^\-]#' 'option key' # TODO complete option keys
}

(( $+functions[_conan_option_values] )) ||
_conan_option_values() {
  _guard '[^\-]#' 'option value' # TODO complete option values
}

(( $+functions[_conan_settings] )) ||
_conan_settings() {
  local ret=1
  if compset -P '*='; then
    _wanted setting-values expl 'setting value' _conan_setting_values ${IPREFIX%=} && ret=0
  else
    _wanted setting-names expl 'setting key' _conan_setting_keys -qS= && ret=0
  fi
  return ret
}

(( $+functions[_conan_setting_keys] )) ||
_conan_setting_keys() {
  _guard '[^\-]#' 'setting key' # TODO complete setting keys
}

(( $+functions[_conan_setting_values] )) ||
_conan_setting_values() {
  _guard '[^\-]#' 'setting value' # TODO complete setting values
}

(( $+functions[_conan_environment_variables] )) ||
_conan_environment_variables() {
  local ret=1
  if compset -P '*='; then
    _wanted environment_variable-values expl 'environment variable value' _conan_environment_variable_values ${IPREFIX%=} && ret=0
  else
    _wanted environment_variable-names expl 'environment variable' _conan_environment_variable_keys -qS= && ret=0
  fi
  return ret
}

(( $+functions[_conan_environment_variable_keys] )) ||
_conan_environment_variable_keys() {
  _parameters -g "*export*"
}

(( $+functions[_conan_environment_variable_values] )) ||
_conan_environment_variable_values() {
  _guard '[^\-]#' 'environment variable value' # TODO complete environment variable values
}

_conan "$@"

# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et
