From 555fdbe3bc536df42a863015823d637f079ef1ed Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Tue, 23 Jun 2026 14:31:29 +0900 Subject: [PATCH 01/21] Implement new subcommand completions --- src/_conan | 268 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 247 insertions(+), 21 deletions(-) diff --git a/src/_conan b/src/_conan index eefbdc7..4fe04a3 100644 --- a/src/_conan +++ b/src/_conan @@ -52,7 +52,8 @@ _conan_common_options=( '-vdebug[verbose level debug]' '-vvv[more and more verbose output]' '-vtrace[verbose level trace]' - '--logger[show the output with log format, with time, type and message]' + '--out-file[write the output of the command to the specified file instead of stdout]:file:_files' + \*{-cc,--core-conf}'[define core configuration, overwriting global.conf values]:value' ) _conan_package_options=( @@ -88,30 +89,43 @@ _conan_lockfile_options=( '(-l --lockfile)'{-l,--lockfile}'[path to a lockfile]: :_files' '--lockfile-partial[do not raise an error if some dependency is not found in lockfile]' '--lockfile-out[filename of the updated lockfile]: :_files' - '--lockfile-packages[lock package-id and package-revision information]' '--lockfile-clean[remove unused entries from the lockfile]' + '*--lockfile-overrides[overwrite lockfile overrides]:overrides' ) _conan_remote_options=( '(-r --remote -nr --no-remote)'{-r,--remote}'[look in the specified remote server]:remote' '(-r --remote -nr --no-remote)'{-nr,--no-remote}'[do not use remote, resolve exclusively in the cache]' + \*{-u,--update}'[will install newer versions for the given references]:update' ) _conan() { - local context state state_descr line + local context state state_descr line ret=1 typeset -A opt_args + local -a conan_reference_options=( + '--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 if not specified in conanfile]:user' + '--channel[provide a channel if not specified in conanfile]:channel' + ) + _arguments -C \ '(- : *)'{-h,--help}'[display help information]' \ '(- : *)'{-v,--version}'[display version information]' \ '(-h --help)1: :_conan_commands' \ - '(-h --help)*:: :->command_args' + '(-h --help)*:: :->command_args' \ + && ret=0 case $state in command_args) - (( $+functions[_conan_${words[1]}] )) && _conan_${words[1]} + if (( $+functions[_conan_${words[1]}] )); then + _call_function ret _conan_${words[1]} && ret=1 + fi ;; esac + + return ret } (( $+functions[_conan_commands] )) || @@ -125,12 +139,17 @@ _conan_commands() { 'install:installs the requirements specified in a "conanfile.py" or "conanfile.txt"' 'list:list recipes, revisions or packages in the cache or the remotes' 'lock:create or manage lockfiles' + 'pkglist:Several operations over package lists' 'profile:manage profiles' 'remote:manage the remote list and the users authenticated on them' 'remove:remove recipes or packages from local cache or a remote' + 'require:Add/remove requirements to/from your local cananfile' + 'run:run a command given a set of requirements from a recipe or command line' 'search:search for package recipes in all the remotes or a remote' + 'version:give information about the Conan client version' + 'workspace:manage Conan workspaces' - # create commands + # creator commands 'build:install dependencies and call the build() method' 'create:create a package' 'download:download(without installing) a single conan package from a remote server' @@ -141,11 +160,19 @@ _conan_commands() { 'source:call the source() method' 'test:test a package from a test_package folder' 'upload:upload packages to a remote' + + # security commands + 'audit:find vulnerabilities in your dependencies' + 'report:get information about the recipe and its sources' ) _describe -t 'subcommands' 'subcommands' commands } +# +# consumer commands +# + (( $+functions[_conan_cache] )) || _conan_cache() { local ret=1 @@ -185,12 +212,27 @@ _conan_cache() { (( $+functions[_conan_config] )) || _conan_config() { + local curcontext=$curcontext state state_descr line ret=1 + typeset -A opt_args + _arguments -C \ '(- : *)'{-h,--help}'[display help information]' \ - '1: :_conan_config_commands' \ - '*:: :->args' + '1: :->subcommand' \ + '*:: :->args' \ + && ret=0 case $state in + (subcommand) + local -a commands=( + 'clean:clean the configuration files in the Conan home folder' + 'home:show the Conan home folder' + 'install:install the configuration into the Conan home folder' + 'install-pkg:install the configuration from a Conan package or a conanconfig.yml file' + 'list:show all the Conan available configurations, core and tools' + 'show:get the value of the specified conf' + ) + _describe -t 'commands' "command" commands && ret=0 + ;; (args) local -a opts=($_conan_common_options[@]) case $words[1] in @@ -203,26 +245,31 @@ _conan_config() { '(-tf --target-folder)'{-tf,--target-folder}'[Install to that path in the conan cache]: :_files -/' ) ;; - (list) + (install-pkg) + opts++( + '(-l --lockfile)'{-l,--lockfile}'[path to a lockfile]:file:_files' + '--lockfile-partial[do not raise an error if some dependency is not found in lockfile]' + '--lockfile-out[file name of the updated lockfile]:file:_files' + '(-f --force)'{-f,--force}'[force the re-installation of configuration]' + '--insecure[allow insecure server connections when using SSL]' + '--url[provide Conan repository URL]:url' + '(-pr --profile)'{-pr,--profile}'[profile to install config]:profile' + '(-s --settings)'{-s,--settings}'[settings to install config]:settings' + '(-o --options)'{-o,--options}'[options to install config]:options' + ) + ;; + (list|show) opts+=( '(-f --format)'{-f,--format}'[select the output format]:format:(json)' ) ;; esac - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 ;; esac -} -(( $+functions[_conan_config_commands] )) || -_conan_config_commands() { - local -a commands=( - 'home:show the Conan home folder' - 'install:install the configuration into the Conan home folder' - 'list:show all the Conan available configurations:' - ) - _describe -t 'commands' "command" commands + return ret } (( $+functions[_conan_graph] )) || @@ -558,6 +605,21 @@ _conan_search() { _arguments "$opts[@]" } +(( $+functions[_conan_version] )) || +_conan_version() { + local ret=1 + _arguments \ + $_conan_common_options[@] \ + '(-f --format)'{-f,--format}'[select the output format]:format:(json)' \ + && ret=0 + + return ret +} + +# +# creator commands +# + (( $+functions[_conan_build] )) || _conan_build() { local -a opts=( @@ -682,6 +744,56 @@ _conan_export-pkg() { _arguments "$opts[@]" } +(( $+functions[_conan_require] )) || +_conan_require() { + local context state state_descr line ret=1 + typeset -A opt_args + + _arguments -C \ + $_conan_common_options[@] \ + '1: :->subcommand' \ + '*:: :->args' \ + && ret=1 + + case $state in + (subcommand) + local -a commands=( + 'add:add a new requirement to your local conanfile as a version range' + 'remove:removes a requirement from your local conanfile' + ) + _describe -t 'commands' "command" commands && ret=0 + ;; + (args) + local -a common_options=( + '--folder[path to a folder containing a recipe(conanfile.py)]:folder:_files -/' + '(-tor --tool)'{-tor,--tool}'[tool requirement name]:name' + '(-ter --test)'{-ter,--test}'[test requirement name]:name' + ) + + case $words[1] in + (add) + _arguments \ + $_conan_common_options[@] \ + $common_options[@] \ + '(-r --remote -nr --no-remote)'{-r,--remote}'[remote names. Accepts wildcards("*")]:remote' \ + '(-r --remote -nr --no-remote)'{-nr,--no-remote}'[do not use remote]' \ + '*::requires' \ + && ret=0 + ;; + (remove) + _arguments \ + $_conan_common_options[@] \ + $common_options[@] \ + '*::name' \ + && ret=0 + ;; + esac + ;; + esac + + return ret +} + (( $+functions[_conan_new] )) || _conan_new() { local -a templates=( @@ -702,7 +814,7 @@ _conan_new() { _conan_source() { local -a opts=( $_conan_common_options[@] - $_conan_package_options[@] + $conan_reference_options[@] '1: :_files' ) @@ -713,7 +825,6 @@ _conan_source() { _conan_test() { local -a opts=( $_conan_common_options[@] - $_conan_package_options[@] \*{-b,--build}'[optional, specify which packages to build from source]:build' $_conan_remote_options[@] '(-u --update)'{-u,--update}'[will check the remote and in case a newer version]' @@ -739,12 +850,127 @@ _conan_upload() { '--force[force the upload of the artifacts]' '--check[perform an integrity check before upload]' '(-c --confirm)'{-c,--confirm}'[upload all matching recipes without confirmation]' + '--dry-run[do not execute the real upload]' + '--allow-disabled[allow uploading to disabled remote]' + '(-l --list)'{-l,--list}'[package list file]:list:_files' + '(-m --metadata)'{-m,--metadata}'[upload the metadata]:metadata:_files' '1::reference' ) _arguments "$opts[@]" } +# +# security commands +# + +(( $+functions[_conan_audit] )) || +_conan_audit() { + local curcontext=$curcontext state state_descr line ret=1 + typeset -A opt_args + + _arguments -C \ + $_conan_common_options[@] \ + '1: :->subcommand' \ + '*:: :->args' \ + && ret=1 + + case $state in + (subcommand) + local -a commands=( + 'list:list the vulnerabilities of the given reference' + 'provider:manage security providers for the "conan audit" command' + 'scan:scan a given recipe for vulnerabilities in its dependencies' + ) + _describe -t 'commands' "command" commands && ret=0 + ;; + (args) + case $words[1] in + (list) + _arguments \ + $_conan_common_options[@] \ + '(-f --format)'{-f,--format}'[select the output format]:format:(json html)' \ + '(-l --list)'{-l,--list}'[package list file to list vulnerabilities for]:list:_files' \ + '(-s --sbom)'{-s,--sbom}'[SBOM file to list vulnerabilities for]:sbom:_files' \ + '(-l --lockfile)'{-l,--lockfile}'[path to the lockfile to check for vulnerabilities]:file:_files' \ + '(-r --remote)'{-r,--remote}'[remote to use for listing]:remote' \ + '(-p --provider)'{-p,--provider}'[provider to use for scanning]:provider' \ + '*::reference' \ + && ret=0 + ;; + (provider) + _arguments \ + $_conan_common_options[@] \ + '(-f --format)'{-f,--format}'[select the output format]:format:(json html)' \ + '--url[provider URL]:url' \ + '--type[provider type]:type:(conan-center-proxy private)' \ + '--token[provider token]:token' \ + '1:action:(add list auth remove)' \ + '*::name' \ + && ret=0 + ;; + (scan) + _arguments \ + $_conan_common_options[@] \ + \*{-b,--build}'[specify which packages to build from source]:build:(never missing cascade)' \ + '--requires[directly provide requires instead of a conanfile]:requires' \ + '--tool-requires[directly provide tool-requires instead of a conanfile]:tool-requires' \ + '(-sl --severity-level)'{-sl,--severity-level}'[set threshold for severity level to raise an error]:level' \ + '--context[context to scan]:context:(host build)' \ + '(-p --provider)'{-p,--provider}'[provider to use for scanning]' \ + $_conan_remote_options[@] \ + $_conan_profile_options[@] \ + $conan_reference_options[@] \ + $_conan_lockfile_options[@] \ + && ret=0 + ;; + esac + ;; + esac + + return ret +} + +(( $+functions[_conan_report] )) || +_conan_report() { + local curcontext=$curcontext state state_descr line ret=1 + typeset -A opt_args + + _arguments -C \ + $_conan_common_options[@] \ + '1: :->subcommand' \ + '*:: :->args' \ + && ret=1 + + case $state in + (subcommand) + local -a commands=( + 'diff:get the difference between two recipes with their sources' + ) + _describe -t 'commands' "command" commands && ret=0 + ;; + (args) + case $words[1] in + (diff) + _arguments \ + $_conan_common_options[@] \ + '(-op --old-path)'{-op,--old-path}'[path to the old recipe]:path:_files' \ + '(-or --old-reference)'{-or,--old-reference}'[old reference]:reference' \ + '(-np --new-path)'{-np,--new-path}'[path to the new recipe]:path:_files' \ + '(-nr --new-reference)'{-nr,--new-reference}'[new reference]:reference' \ + '(-r --remote)'{-r,--remote}'[look in the specified remote or remotes server]:remote' \ + && ret=0 + ;; + esac + ;; + esac + + return ret +} + +# +# Utilities +# (( $+functions[_conan_remotes] )) || _conan_remotes() { local -a remotes=(${(f)"$(_call_program remotes $service remote list)"}) From ecc975048028dbf400cb3fa2003836bb2c278a62 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Tue, 23 Jun 2026 17:44:46 +0900 Subject: [PATCH 02/21] update 'cache' command completion --- src/_conan | 60 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 7 deletions(-) diff --git a/src/_conan b/src/_conan index 4fe04a3..24ca4c5 100644 --- a/src/_conan +++ b/src/_conan @@ -175,39 +175,85 @@ _conan_commands() { (( $+functions[_conan_cache] )) || _conan_cache() { - local ret=1 + local curcontext=$curcontext state state_descr line ret=1 + typeset -A opt_args _arguments -C \ - '(- *)'{-h,--help}'[show help message and exit]' \ - '1: :(clean path)' \ - '*:: :->args' + $_conan_common_options[@] \ + '1:subcommand:->subcommand' \ + '*:: :->args' \ + && ret=0 case $state in + (subcommand) + local -a commands=( + 'backup-upload:upload all the source backups present in the cache' + 'check-integrity:check the integrity of the local cache for the given references' + 'clean:remove non-critical folders from the cache' + 'path:show the path to the Conan cache for a given reference' + 'ref:show the reference for a given Conan cache folder' + 'restore:put the artifacts from an archive into the cache' + 'save:get the artifacts from a package list and archive them' + 'sign:sign packages with the Package Signing Plugin' + 'verify:check the signature of packages with the Package Signing Plugin' + ) + _describe -t 'commands' "command" commands && ret=0 + ;; (args) local -a opts=($_conan_common_options[@]) case $words[1] in + (check-integrity|sign|verify) + opts+=( + '(-f --format)'{-f,--format}'[select the output format]:format:(json)' + '(-l --list)'{-l,--list}'[package list of packages to check integrity for]:list' + \*{-p,--package-query}'[only the packages matching a specific query]:query' + '1:pattern' + ) + ;; (clean) opts+=( + '(-l --list)'{-l,--list}'[package list of packages to clean]:list' '(-s --source)'{-s,--source}'[clean source folders]' '(-b --build)'{-b,--build}'[clean build folders]' '(-d --download)'{-d,--download}'[clean download folders]' + '(-t --temp)'{-t,--temp}'[clean temporary folders]' + '(-bs --backup-sources)'{-bs,--backup-sources}'[clean backup sources]' \*{-p,--package-query}'[remove only the packages matching a specific query]:query' '1:pattern' ) ;; (path) opts+=( - '--folder[path to show]::type:(export_source source build)' \ + '--folder[path to show]::type:(export_source source build metadata)' \ '1:recipe_or_package_reference:_files' ) ;; + (ref) + opts+=( + '1:folder:_files -/' + ) + ;; + (restore) + opts+=( + '1:path:_files' + ) + ;; + (save) + opts+=( + '(-f --format)'{-f,--format}'[select the output format]:format:(json)' + '(-l --list)'{-l,--list}'[package list of packages to check integrity for]:list' + '--file[save to this file]:file:_files -g "*.(tgz|txz|tzst)"' + '--no-source[exclude the sources]' + '1:pattern' + ) + ;; esac - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 ;; esac - return $ret + return ret } (( $+functions[_conan_config] )) || From a761ad30f7523ef2c1f86d97946905d11ffbf6de Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Tue, 23 Jun 2026 18:34:17 +0900 Subject: [PATCH 03/21] update 'inspect' command completion --- src/_conan | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/_conan b/src/_conan index 24ca4c5..28dbbd9 100644 --- a/src/_conan +++ b/src/_conan @@ -381,10 +381,19 @@ _conan_graph_commands() { (( $+functions[_conan_inspect] )) || _conan_inspect() { + local ret=1 + _arguments \ - "$_conan_common_options[@]" \ + $_conan_common_options[@] \ '(-f --format)'{-f,--format}'[select the output format]:format:(json)' \ - '*:recipe_folder:_files -/' + '(-r --remote -nr --no-remote)'{-r,--remote}'[remote names. Accepts wildcards("*")]:remote' \ + '(-r --remote -nr --no-remote)'{-nr,--no-remote}'[do not use remote]' \ + '(-l --lockfile)'{-l,--lockfile}'[path to a lockfile]:path:_files' \ + '--lockfile-partial[do not raise an error if some dependnecy is not found in lockfile]' \ + '*:recipe_folder:_files -/' \ + && ret=0 + + return ret } (( $+functions[_conan_install] )) || From cdec11a66b13ef1832300f13250c1019127bf45b Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Tue, 23 Jun 2026 18:34:28 +0900 Subject: [PATCH 04/21] update 'new' command completion --- src/_conan | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/_conan b/src/_conan index 28dbbd9..a7734b1 100644 --- a/src/_conan +++ b/src/_conan @@ -851,18 +851,22 @@ _conan_require() { (( $+functions[_conan_new] )) || _conan_new() { + local ret=1 local -a templates=( - basic cmake_lib cmake_exe meson_lib meson_exe msbuild_lib msbuild_exe - bezel_lib bezel_exe autotools_lib autotools_exe + basic cmake_lib cmake_exe header_lib meson_lib meson_exe msbuild_lib msbuild_exe + bezel_lib bezel_exe autotools_lib autotools_exe premake_lib premake_exe + local_recipes_index workspace ) local -a opts=( $_conan_common_options[@] \*{-d,--define}'[define a template argument as key=value]:key_value' '(-f --force)'{-f,--force}'[overwrite file if it already exists]' - "1:template:($templates)" + '(-o --output)'{-o,--output}'[output folder for the generated files]:folder:_files -/' + '1:template:($templates)' ) - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 + return ret } (( $+functions[_conan_source] )) || From fd93dc2e75a76c085760afe7c06168389034b758 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Tue, 23 Jun 2026 18:37:38 +0900 Subject: [PATCH 05/21] update 'download' command completion --- src/_conan | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/_conan b/src/_conan index a7734b1..70884db 100644 --- a/src/_conan +++ b/src/_conan @@ -717,15 +717,19 @@ _conan_create() { (( $+functions[_conan_download] )) || _conan_download() { + local ret=1 local -a opts=( $_conan_common_options[@] '--only-recipe[download only the recipe, not the binary packages]' \*{-p,--package-query}'[only download packages matching a specific query]:query' '(-r --remote)'{-r,--remote}'[download from the specific remote]:remote:_conan_remotes' + '(-m --metadata)'{-m,--metadata}'[download the metadata matching the pattern]:pattern' + '(-l --list)'{-l,--list}'[package list file]:list:_files' '*:recipe_or_package_reference:_files' ) - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 + return ret } (( $+functions[_conan_editable] )) || From e30bfd3582eb80576e8922b1f7b98eaa935f1a24 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Tue, 23 Jun 2026 18:43:44 +0900 Subject: [PATCH 06/21] update 'editable' command completion --- src/_conan | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/_conan b/src/_conan index 70884db..c7f12bb 100644 --- a/src/_conan +++ b/src/_conan @@ -734,42 +734,52 @@ _conan_download() { (( $+functions[_conan_editable] )) || _conan_editable() { + local curcontext=$curcontext state state_descr line ret=1 + typeset -A opt_args + _arguments -C \ - '(- : *)'{-h,--help}'[display help information]' \ - '1: :_conan_editable_commands' \ - '*:: :->args' + $_conan_common_options[@] \ + '1:subcommand:->subcommand' \ + '*:: :->args' \ + && ret=0 case $state in + (subcommand) + local -a commands=( + 'add:define the given path location as the package reference' + 'list:list all the packages in editable mode' + 'remove:remove the editable mode for this reference' + ) + _describe -t 'commands' "command" commands && ret=0 + ;; (args) local opts=($_conan_common_options[@]) case $words[1] in (add) opts+=( - $_conan_package_options[@] '(-of --output-folder)'{-of,--output-folder}'[the root output folder]:folder:_files -/' + '(-r --remote -nr --no-remote)'{-r,--remote}'[look in the specified remote server]:remote' + '(-r --remote -nr --no-remote)'{-nr,--no-remote}'[do not use remote]' + $conan_reference_options[@] + '*:folder:_files -/' ) ;; (list) opts+=('(-f --format)'{-f,--format}'[select the output format]:format:(json)') ;; (remove) - opts+=('(-r --refs)'{-r,--refs}'[directly provide reference patterns]:refs') + opts+=( + '(-r --refs)'{-r,--refs}'[directly provide reference patterns]:refs' + '*:folder:_files -/' + ) ;; esac - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 ;; esac -} -(( $+functions[_conan_editable_commands] )) || -_conan_editable_commands() { - local -a commands=( - 'add:define the given path location as the package reference' - 'list:list all the packages in editable mode' - 'remove:remove the editable mode for this reference' - ) - _describe -t 'commands' "command" commands + return ret } (( $+functions[_conan_export] )) || From 92b1ac0e5125a0079d75ee3ecc207bd306058a49 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Wed, 24 Jun 2026 09:08:35 +0900 Subject: [PATCH 07/21] update 'export' command completion --- src/_conan | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/_conan b/src/_conan index c7f12bb..ede6151 100644 --- a/src/_conan +++ b/src/_conan @@ -786,10 +786,13 @@ _conan_editable() { _conan_export() { local -a opts=( $_conan_common_options[@] - $_conan_package_options[@] - $_conan_remote_options[@] - $_conan_lockfile_options[@] + '(-r --remote -nr --no-remote)'{-r,--remote}'[remote names. Accepts wildcards("*")]:remote' + '(-r --remote -nr --no-remote)'{-nr,--no-remote}'[do not use remote]' + '(-l --lockfile)'{-l,--lockfile}'[path to a lockfile]:file:_files' + '--lockfile-out[file name of the updated lockfile]:file:_files' + '--lockfile-partial[do not raise an error if some dependency is not found in lockfile]' '--build-require[whether the provided reference is a build-require]' + $conan_reference_options[@] '*: :_files -/' ) From 6ff45c8fc7b635287880c7bb8b4046ce89664d49 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Wed, 24 Jun 2026 09:36:05 +0900 Subject: [PATCH 08/21] fix profile options issue It was not excaped characters correctly --- src/_conan | 91 ++++++++++++++++++++---------------------------------- 1 file changed, 34 insertions(+), 57 deletions(-) diff --git a/src/_conan b/src/_conan index ede6151..780a284 100644 --- a/src/_conan +++ b/src/_conan @@ -65,26 +65,6 @@ _conan_package_options=( '--tool-requires[directly provide tool-requires instead of a conanfile]:tool_requires' ) -_conan_define_options=( - \*{-o,--options,'-o\:h','--options\:host'}'[define options of host machine]:option' - \*{'-o\:b','--options\:build'}'[define options of build machine]:option' -) - -_conan_profile_options=( - '(-pr --profile -pr\:h --profile\:host)'{-pr,--profile,-pr:h,--profile:host}'[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' -) - -_conan_setting_options=( - \*{-s,--settings,'-s\:h','--settings\:host'}'[overwrite the defaults of host machine to build]:setting' - \*{'-s\:b','--settings\:build'}'[overwrite the defaults of build machine to build]:setting' -) - -_conan_configuration_options=( - \*{-c,--conf,'-c\:h','--conf\:host'}'[overwrite the defaults of host machine to configure]:config' - \*{'-c\:b','--conf\:build'}'[overwrite the defaults of build machine to configure]:config' -) - _conan_lockfile_options=( '(-l --lockfile)'{-l,--lockfile}'[path to a lockfile]: :_files' '--lockfile-partial[do not raise an error if some dependency is not found in lockfile]' @@ -110,6 +90,25 @@ _conan() { '--channel[provide a channel if not specified in conanfile]:channel' ) + local -a conan_profile_options=( + '(-pr --profile)'{-pr,--profile}'[apply the specified profile]:profile' + '(-pr\:b --profile\:build)'{-pr\\:b,--profile\\:build}'[apply the specified profile build]:profile_build' + '(-pr\:h --profile\:host)'{-pr\\:h,--profile\\:host}'[apply the specified profile host]:profile_host' + '(-pr\:a --profile\:all)'{-pr\\:a,--profile\\:apply}'[apply the specified profile all]:profile_all' + '(-o --options)'{-o,--options}'[apply the specified options]:options' + '(-o\:b --options\:build)'{-o\\:b,--options\\:build}'[apply the specified options build]:options_build' + '(-o\:h --options\:host)'{-o\\:h,--options\\:host}'[apply the specified options host]:options_host' + '(-o\:a --options\:all)'{-o\\:a,--options\\:all}'[apply the specified options all]:options_all' + '(-s --settings)'{-s,--settings}'[apply the specified settings]:settings' + '(-s\:b --settings\:build)'{-s\\:b,--settings\\:build}'[apply the specified settings build]:settings_build' + '(-s\:h --settings\:host)'{-s\\:h,--settings\\:host}'[apply the specified settings host]:settings_host' + '(-s\:a --settings:all)'{-s\\:a,--settings\\:all}'[apply the specified settings all]:settings_all' + '(-c --conf)'{-c,--conf}'[apply the specified conf]:conf' + '(-c\:b --conf\:build)'{-c\\:b,--conf\\:build}'[apply the specified conf]:conf_build' + '(-c\:h --conf\:host)'{-c\\:h,--conf\\:host}'[apply the specified conf]:conf_host' + '(-c\:a --conf\:all)'{-c\\:a,--conf\\:all}'[apply the specified conf all]:conf_all' + ) + _arguments -C \ '(- : *)'{-h,--help}'[display help information]' \ '(- : *)'{-v,--version}'[display version information]' \ @@ -330,10 +329,7 @@ _conan_graph() { \*{-b,--build}'[optional, specify which packages to build from source]:build' $_conan_remote_options[@] '(-u --update)'{-u,--update}'[will check the remote and in case a newer version]' - $_conan_define_options[@] - $_conan_profile_options[@] - $_conan_setting_options[@] - $_conan_configuration_options[@] + $conan_profile_options[@] $_conan_lockfile_options[@] ) @@ -410,10 +406,7 @@ _conan_install() { \*{-b,--build}'[optional, specify which packages to build from source]:build' $_conan_remote_options[@] '(-u --update)'{-u,--update}'[will check the remote and in case a newer version]' - $_conan_define_options[@] - $_conan_profile_options[@] - $_conan_setting_options[@] - $_conan_configuration_options[@] + $conan_profile_options[@] $_conan_lockfile_options[@] '(-g --generator)'{-g,--generator}"[generators to use]:generator:($generators)" '(-of --output)'{-of,--output-folder}'[the root output folder for generated and build files]:dir:_files -/' @@ -463,10 +456,7 @@ _conan_lock() { \*{-b,--build}'[optional, specify which packages to build from source]:build' $_conan_remote_options[@] '(-u --update)'{-u,--update}'[will check the remote and in case a newer version]' - $_conan_define_options[@] - $_conan_profile_options[@] - $_conan_setting_options[@] - $_conan_configuration_options[@] + $conan_profile_options[@] $_conan_lockfile_options[@] '1: :_files' ) @@ -518,10 +508,7 @@ _conan_profile() { ;; (path|show) opts+=( - $_conan_define_options[@] - $_conan_profile_options[@] - $_conan_setting_options[@] - $_conan_configuration_options[@] + $conan_profile_options[@] ) ;; esac @@ -683,10 +670,7 @@ _conan_build() { \*{-b,--build}'[optional, specify which packages to build from source]:build' $_conan_remote_options[@] '(-u --update)'{-u,--update}'[will check the remote and in case a newer version]' - $_conan_define_options[@] - $_conan_profile_options[@] - $_conan_setting_options[@] - $_conan_configuration_options[@] + $conan_profile_options[@] $_conan_lockfile_options[@] '*: :_files' ) @@ -696,23 +680,22 @@ _conan_build() { (( $+functions[_conan_create] )) || _conan_create() { + local ret=1 local -a opts=( $_conan_common_options[@] - $_conan_package_options[@] \*{-b,--build}'[optional, specify which packages to build from source]:build' - $_conan_remote_options[@] '(-u --update)'{-u,--update}'[will check the remote and in case a newer version]' - $_conan_define_options[@] - $_conan_profile_options[@] - $_conan_setting_options[@] - $_conan_configuration_options[@] - $_conan_lockfile_options[@] '--build-require[whether the provided reference is a build-require]' '(-tf --test-folder)'{-tf,--test-folder}'[alternative test folder name]:folder:_files -/' + $conan_reference_options[@] + $_conan_lockfile_options[@] + $_conan_remote_options[@] + $conan_profile_options[@] '*: :_files -/' ) - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 + return ret } (( $+functions[_conan_download] )) || @@ -806,10 +789,7 @@ _conan_export-pkg() { $_conan_package_options[@] $_conan_remote_options[@] $_conan_lockfile_options[@] - $_conan_define_options[@] - $_conan_profile_options[@] - $_conan_setting_options[@] - $_conan_configuration_options[@] + $conan_profile_options[@] '*: :_files -/' ) @@ -904,10 +884,7 @@ _conan_test() { \*{-b,--build}'[optional, specify which packages to build from source]:build' $_conan_remote_options[@] '(-u --update)'{-u,--update}'[will check the remote and in case a newer version]' - $_conan_define_options[@] - $_conan_profile_options[@] - $_conan_setting_options[@] - $_conan_configuration_options[@] + $conan_profile_options[@] $_conan_lockfile_options[@] '1:path:_files -/' '2:reference' @@ -995,7 +972,7 @@ _conan_audit() { '--context[context to scan]:context:(host build)' \ '(-p --provider)'{-p,--provider}'[provider to use for scanning]' \ $_conan_remote_options[@] \ - $_conan_profile_options[@] \ + $conan_profile_options[@] \ $conan_reference_options[@] \ $_conan_lockfile_options[@] \ && ret=0 From 64e9cc76db28cd87b486a2fc11600aeef2097311 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Wed, 24 Jun 2026 09:55:02 +0900 Subject: [PATCH 09/21] update 'graph' command completion --- src/_conan | 85 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 33 deletions(-) diff --git a/src/_conan b/src/_conan index 780a284..3df626e 100644 --- a/src/_conan +++ b/src/_conan @@ -319,60 +319,79 @@ _conan_config() { (( $+functions[_conan_graph] )) || _conan_graph() { - _arguments -C \ - '(- : *)'{-h,--help}'[display help information]' \ - '1: :_conan_graph_commands' \ - '*:: :->args' + local curcontext=$curcontext state state_descr line ret=1 + typeset -A opt_args - local -a common_opts=( - $_conan_package_options[@] - \*{-b,--build}'[optional, specify which packages to build from source]:build' - $_conan_remote_options[@] - '(-u --update)'{-u,--update}'[will check the remote and in case a newer version]' - $conan_profile_options[@] - $_conan_lockfile_options[@] - ) + _arguments -C \ + '1:subcommand:->subcommand' \ + '*:: :->args' \ + && ret=0 case $state in + (subcommand) + local -a commands=( + 'build-order:compute the build order of a dependency graph' + 'build-order-merge:merge more than 1 build-order file' + 'explain:explan what is wrong with the dependency graph' + 'info:compute the dependency graph and shows information about it' + 'outdated:list the dependencies in the graph and it is newer versions in the remote' + ) + _describe -t 'commands' "command" commands && ret=0 + ;; (args) local -a opts=($_conan_common_options[@]) case $words[1] in - (build-order) + (build-order|explain|info|outdated) opts+=( - '(-f --format)'{-f,--format}'[select the output format]:format:(json)' - $common_opts[@] + \*{-b,--build}'[optional, specify which packages to build from source]:build' + '--requires[directly provide requires instead of a conanfile]:requires' + '--tool-requires[directly provide tool-requires instead of a conanfile]:tool-requires' + $_conan_remote_options[@] + $conan_profile_options[@] + $conan_reference_options[@] + $_conan_lockfile_options[@] + '*:folder:_files -/' + ) + ;| + (explain|info|outdated) + opts+=( + '--check-updates[check if there are recipe updates]' + '--build-require[whether the provided reference is a build-require]' ) ;; - (build-order-merge) + (build-order) opts+=( - '--file[files to be merged]:file:_files' + '--order-by[select how to order the output(default "recipe")]:type:(recipe configuration)' + '--reduce[reduce the build order, output only those to build]' + ) + ;; + (explain) + opts+=( + '*--missing[a pattern in the form "pkg/version#revision:package_id#revision"]:pattern' ) ;; (info) opts+=( - $common_opts[@] - '(-f --format)'{-f,--format}'[select the output format]:format:(html json dot)' - '--check-updates[check if there are recipe updates]' - '*--filter[show only the specified fields]:filter' - '*--package-filter[print information only for packages that match the patterns]:package_filter' - '--deploy[deploy using the provided deployer to the output folder]:deployer' + '*--filter[show only the specified fields]:pattern' + '*--package-filter[print information only for packages that match the patterns]:pattern' + '(-d --deployer)'{-d,--deployer}'[deploy using the provided deployer to the output folder]:deployer:(full_deploy direct_deploy)' + '(-df --deployer-folder)'{-df,--deployer-folder}'[deployer output folder]:folder:_files -/' + ) + ;; + (build-order-merge) + opts+=( + '(-f --format)'{-f,--format}'[select the output format]:format:(json html)' + '*--file[files to be merged]:file:_files' + '--reduce[reduce the build order, output only those to build]' ) ;; esac - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 ;; esac -} -(( $+functions[_conan_graph_commands] )) || -_conan_graph_commands() { - local -a commands=( - 'build-order:compute the build order of a dependency graph' - 'build-order-merge:merge more than 1 build-order file' - 'info:compute the dependency graph and shows information about it' - ) - _describe -t 'commands' "command" commands + return ret } (( $+functions[_conan_inspect] )) || From 678f859cac02f3bcd0329b8eacb44e8b049e9698 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Wed, 24 Jun 2026 10:05:00 +0900 Subject: [PATCH 10/21] update 'build' command completion --- src/_conan | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/_conan b/src/_conan index 3df626e..ad294ff 100644 --- a/src/_conan +++ b/src/_conan @@ -104,8 +104,8 @@ _conan() { '(-s\:h --settings\:host)'{-s\\:h,--settings\\:host}'[apply the specified settings host]:settings_host' '(-s\:a --settings:all)'{-s\\:a,--settings\\:all}'[apply the specified settings all]:settings_all' '(-c --conf)'{-c,--conf}'[apply the specified conf]:conf' - '(-c\:b --conf\:build)'{-c\\:b,--conf\\:build}'[apply the specified conf]:conf_build' - '(-c\:h --conf\:host)'{-c\\:h,--conf\\:host}'[apply the specified conf]:conf_host' + '(-c\:b --conf\:build)'{-c\\:b,--conf\\:build}'[apply the specified conf build]:conf_build' + '(-c\:h --conf\:host)'{-c\\:h,--conf\\:host}'[apply the specified conf host]:conf_host' '(-c\:a --conf\:all)'{-c\\:a,--conf\\:all}'[apply the specified conf all]:conf_all' ) @@ -683,18 +683,26 @@ _conan_version() { (( $+functions[_conan_build] )) || _conan_build() { + local ret=1 + local -a opts=( $_conan_common_options[@] - $_conan_package_options[@] + \*{-g,--generator}'[generators to use]:generator' + '(-of --output-folder)'{-of,--output-folder}'[root output folder for generated and build files]:folder:_files -/' + '(-d --deployer)'{-d,--deployer}'[deploy using the provided deployer to the output folder]:deployer:(full_deploy direct_deploy)' + '(-df --deployer-folder)'{-df,--deployer-folder}'[deployer output folder]:folder:_files -/' + '--build-require[whether the provided reference is a build-require]' + '--envs-generation[generation strategy for virtual environment files for the root]:flag:(false)' \*{-b,--build}'[optional, specify which packages to build from source]:build' + $conan_reference_options[@] $_conan_remote_options[@] - '(-u --update)'{-u,--update}'[will check the remote and in case a newer version]' $conan_profile_options[@] $_conan_lockfile_options[@] '*: :_files' ) - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 + return ret } (( $+functions[_conan_create] )) || From 0716597f43fdf44dd9b7c8a4f66e9f715eb13aa0 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Wed, 24 Jun 2026 10:11:34 +0900 Subject: [PATCH 11/21] update 'export-pkg' command completion --- src/_conan | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/_conan b/src/_conan index ad294ff..621325f 100644 --- a/src/_conan +++ b/src/_conan @@ -56,15 +56,6 @@ _conan_common_options=( \*{-cc,--core-conf}'[define core configuration, overwriting global.conf values]:value' ) -_conan_package_options=( - '--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' - '--requires[directly provide requires instead of a conan file]:requires' - '--tool-requires[directly provide tool-requires instead of a conanfile]:tool_requires' -) - _conan_lockfile_options=( '(-l --lockfile)'{-l,--lockfile}'[path to a lockfile]: :_files' '--lockfile-partial[do not raise an error if some dependency is not found in lockfile]' @@ -811,16 +802,23 @@ _conan_export() { (( $+functions[_conan_export-pkg] )) || _conan_export-pkg() { + local ret=1 local -a opts=( $_conan_common_options[@] - $_conan_package_options[@] - $_conan_remote_options[@] + '(-of --output-folder)'{-of,--output-folder}'[root output folder for generated and build files]:folder:_files -/' + '--build-require[whether the provided reference is a build-require]' + '(-tf --test-folder)'{-tf,--test-folder}'[alternative test folder name]:folder:_files -/' + '(-sb --skip-binaries)'{-sb,--skip-binaries}'[skip installing dependencies binaries]' + '(-r --remote -nr --no-remote)'{-r,--remote}'[look in the specified remote or remote servers]:remote' + '(-r --remote -nr --no-remote)'{-nr,--no-remote}'[do not use remote]' + $conan_reference_options[@] $_conan_lockfile_options[@] $conan_profile_options[@] '*: :_files -/' ) - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 + return ret } (( $+functions[_conan_require] )) || From 7d748144493fe1d63874a8bf15ede89efb31cf49 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Wed, 24 Jun 2026 14:00:12 +0900 Subject: [PATCH 12/21] update 'list' command completion --- src/_conan | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/_conan b/src/_conan index 621325f..2c45414 100644 --- a/src/_conan +++ b/src/_conan @@ -429,16 +429,26 @@ _conan_install() { (( $+functions[_conan_list] )) || _conan_list() { + local ret=1 local -a opts=( $_conan_common_options[@] - '(-f --format)'{-f,--format}'[select the output format]:format:(json html)' + '(-f --format)'{-f,--format}'[select the output format]:format:(json html compact)' \*{-p,--package-query}'[remove only the packages matching a specific query]:query' + \*{-fp,--filter-profile}'[profiles to filter the binaries]:filter_profile' + \*{-fs,--filter-settings}'[settings to filter the binaries]:filter_settings' + \*{-fo,--filter-options}'[options to filter the binaries]:filter_options' '(-r --remote)'{-r,--remote}'[remote names]:remote' '(-c --cache)'{-c,--cache}'[search in the local cache]' + '(-g --graph)'{-g,--graph}'[graph json file]:file:_files' + '(-gb --graph-binaries)'{-gb,--graph-binaries}'[which binaries are listed]:graph_binaries' + '(-gr --graph-recipes)'{-gr,--graph-recipes}'[which recipes are listed]:graph_recipes' + '(-gc --graph-context)'{-gc,--graph-context}'[filter the results by the given context]:context:(build host build-only host-only)' + '--lru[list recipes and binaries that have not been recently used]:lru' '1:recipe_or_package_reference:_files' ) - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 + return ret } (( $+functions[_conan_lock] )) || From 9674907aeab7eca9ca51fd27716ba2038f39ac3a Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Wed, 24 Jun 2026 16:28:28 +0900 Subject: [PATCH 13/21] update 'lock' command completion --- src/_conan | 84 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 69 insertions(+), 15 deletions(-) diff --git a/src/_conan b/src/_conan index 2c45414..fdf1ad1 100644 --- a/src/_conan +++ b/src/_conan @@ -453,12 +453,27 @@ _conan_list() { (( $+functions[_conan_lock] )) || _conan_lock() { + local curcontext=$curcontext state state_descr line ret=1 + typeset -A opt_args + _arguments -C \ '(- : *)'{-h,--help}'[display help information]' \ - '1: :_conan_lock_commands' \ + '1:subcommand:->subcommand' \ '*:: :->args' case $state in + (subcommand) + local -a commands=( + 'add:add requires, build-requires or python requires to an existing or new lockfile' + 'create:create a lockfile from a conanfile or a reference' + 'merge:merge 2 or more lockfiles' + 'remove:remove requires, build-requires or python-requires from an existing lockfile' + 'update:update requires' + 'upgrade:upgrade requires, build-requires or python-requires from an exiting lockfile' + 'upgrade-config:upgrade config requires in a lockfile' + ) + _describe -t 'commands' "command" commands && ret=0 + ;; (args) local -a opts=($_conan_common_options) case $words[1] in @@ -474,34 +489,73 @@ _conan_lock() { (create) opts+=( \*{-b,--build}'[optional, specify which packages to build from source]:build' + '--requires[directly provide requires instead of a conanfile]:requires' + '--tool-requires[directly provide tool-requires instead of a conanfile]:tool-requires' + '--build-require[whether the provided reference is a build-require]' $_conan_remote_options[@] - '(-u --update)'{-u,--update}'[will check the remote and in case a newer version]' $conan_profile_options[@] + $conan_reference_options[@] $_conan_lockfile_options[@] '1: :_files' ) - ;; + ;; (merge) opts+=( + '--lockfile[file name of the input lockfile]:filename:_files' + '--lockfile-out[file name of the created lockfile]:filename:_files' + ) + ;; + (remove) + opts+=( + '*--build-requires[remove build-requires from lockfile]:build_requires' + '*--python-requires[remove python-requires from lockfile]' + '*--config-requires[remove config-requires from lockfile]' '--lockfile-out[file name of the created lockfile]:filename:_files' '--lockfile[file name of the input lockfile]:filename:_files' ) - ;; + ;; + (update) + opts+=( + '*--requires[update references to lockfile]:requires' + '*--build-requires[update build-requires from lockfile]:build_requires' + '*--python-requires[update python-requires from lockfile]' + '*--config-requires[update config-requires from lockfile]' + '--lockfile-out[file name of the created lockfile]:filename:_files' + '--lockfile[file name of the input lockfile]:filename:_files' + ) + ;; + (upgrade) + opts+=( + '--requires[directly provide requires instead of a conanfile]:requires' + '--tool-requires[directly provide tool-requires instead of a conanfile]:tool-requires' + \*{-ur,--update-requires}'[update requires from lockfile]:update_requires' + \*{-ubr,--update-build-requires}'[update build-requires from lockfile]:update_build_requires' + \*{-upr,--update-python-requires}'[update python-requires from lockfile]:update_python_requires' + '*--build-requires[update build-requires from lockfile]:build_requires' + $_conan_remote_options[@] + $conan_profile_options[@] + $conan_reference_options[@] + $_conan_lockfile_options[@] + ) + ;; + (upgrade-config) + opts+=( + '--requires[directly provide requires instead of a conanfile]:requires' + '--tool-requires[directly provide tool-requires instead of a conanfile]:tool-requires' + '*--update-config-requires[update config-requires from lockfile]:update_config_requires' + $_conan_remote_options[@] + $conan_profile_options[@] + $conan_reference_options[@] + $_conan_lockfile_options[@] + ) + ;; esac - _arguments "$opts[@]" - ;; + _arguments "$opts[@]" && ret=1 + ;; esac -} -(( $+functions[_conan_lock_commands] )) || -_conan_lock_commands() { - local -a commands=( - 'add:add requires, build-requires or python requires to an existing or new lockfile' - 'create:create a lockfile from a conanfile or a reference' - 'merge:merge 2 or more lockfiles' - ) - _describe -t 'commands' "command" commands + return ret } (( $+functions[_conan_profile] )) || From 81565c73e17a42b5f7cec212578d59c9cb59e18a Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 25 Jun 2026 11:21:35 +0900 Subject: [PATCH 14/21] update 'remote' command completion --- src/_conan | 61 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/src/_conan b/src/_conan index fdf1ad1..7c6b81f 100644 --- a/src/_conan +++ b/src/_conan @@ -605,12 +605,33 @@ _conan_profile_commands() { (( $+functions[_conan_remote] )) || _conan_remote() { + local curcontext=$curcontext state state_descr line ret=1 + typeset -A opt_args + _arguments -C \ - '(- : *)'{-h,--help}'[display help information]' \ - '1: :_conan_remote_commands' \ - '*:: :->args' + $_conan_common_options[@] \ + '1:subcommand:->subcommand' \ + '*:: :->args' \ + && ret=0 case $state in + (subcommand) + local -a commands=( + 'add:add a remote' + 'auth:authenticate in the defined remotes' + 'disable:disable all the remotes matching a pattern' + 'enable:enable all the remotes matching a pattern' + 'list:list current remotes' + 'list-users:list the users logged into all the remotes' + 'login:login into the specified remotes matching a pattern' + 'logout:clear the existing credentials for the specified remotes matching a pattern' + 'remove:remove a remote' + 'rename:rename a remote' + 'set-user:associate a username with a remote matching pattern without performing the authentication' + 'update:update a remote' + ) + _describe -t 'commands' "command" commands && ret=0 + ;; (args) local -a opts=($_conan_common_options[@]) case $words[1] in @@ -619,6 +640,9 @@ _conan_remote() { '--insecure[allow insecure server connections when using SSL]' '--index[insert the remote at a specific position in the remote list]:index' '(-f --force)'{-f,--force}'[force the definition of the remote even if duplicated]' + \*{-ap,--allowed-packages}'[add recipe reference pattern to list of allowed packages]:allowed_packages' + '(-t --type)'{-t,--type}'[define the remote type]:type:(local-recipes-index)' + '--recipes-only[disallow binary downloads from this remote, only recipes will be downloaded]' '1:name' '2:url' ) @@ -626,6 +650,8 @@ _conan_remote() { (auth) opts+=( '--with-user[only try to auth in those remotes that already have a user name]' + '--force[force authentication for anonymous-enabled repositories]' + '--strict[return exit code 1 if authentication fails for any remote]' '1:remote:_conan_remotes' ) ;; @@ -637,7 +663,7 @@ _conan_remote() { '(-f --format)'{-f,--format}'[select the output format]:format:(json)' '(-p --password)'{-p,--password}'[user password]:password' '1:remote:_conan_remotes' - '2:username:' + '2:username' ) ;; (logout) @@ -664,37 +690,22 @@ _conan_remote() { ;; (update) opts+=( - '--url[new url for the remote]' + '--url[new url for the remote]:url' '--secure[do not allow insecure server connections when using SSL]' '--insecure[allow insecure server connections when using SSL]' '--index[insert the remote at a specific position in the remote list]:index' + \*{-ap,--allowed-packages}'[add recipe reference pattern to list of allowed packages]:allowed_packages' + '--recipes-only[disallow binary downloads from this remote, only recipes will be downloaded]:bool:(True False)' '1:remote:_conan_remotes' ) ;; esac - _arguments "${opts[@]}" - ;; + _arguments "${opts[@]}" && ret=0 + ;; esac -} -(( $+functions[_conan_remote_commands] )) || -_conan_remote_commands() { - local -a commands=( - 'add:add a remote' - 'auth:authenticate in the defined remotes' - 'disable:disable all the remotes matching a pattern' - 'enable:enable all the remotes matching a pattern' - 'list:list current remotes' - 'list-users:list the users logged into all the remotes' - 'login:login into the specified remotes matching a pattern' - 'logout:clear the existing credentials for the specified remotes matching a pattern' - 'remove:remove a remote' - 'rename:rename a remote' - 'set-user:associate a username with a remote matching pattern without performing the authentication' - 'update:update a remote' - ) - _describe -t 'commands' "command" commands + return ret } (( $+functions[_conan_remove] )) || From f031b84aa8f0b95bfa88fc4b54ea8b88bb5ef87d Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 25 Jun 2026 11:33:41 +0900 Subject: [PATCH 15/21] update 'profile' command completion --- src/_conan | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/src/_conan b/src/_conan index 7c6b81f..b4f5222 100644 --- a/src/_conan +++ b/src/_conan @@ -560,12 +560,25 @@ _conan_lock() { (( $+functions[_conan_profile] )) || _conan_profile() { + local curcontext=$curcontext state state_descr line ret=1 + typeset -A opt_args + _arguments -C \ '(- : *)'{-h,--help}'[display help information]' \ - '1: :_conan_profile_commands' \ - '*:: :->args' + '1:subcommand:->subcommand' \ + '*:: :->args' \ + && ret=0 case $state in + (subcommand) + local -a commands=( + 'detect:generate a profile using auto-detected values' + 'list:list all profiles in the cache' + 'path:show profile path location' + 'show:show aggregated profiles from the passed arguments' + ) + _describe -t 'commands' "command" commands && ret=0 + ;; (args) local opts=($_conan_common_options[@]) case $words[1] in @@ -573,6 +586,7 @@ _conan_profile() { opts+=( '--name[profile name, "default" if not specified]::name' '(-f --force)'{-f,--force}'[overwrite if exists]' + '(-e --exist-ok)'{-e,--exist-ok}'[if the profile already exist, do not detect a new one]' ) ;; (list) @@ -580,27 +594,22 @@ _conan_profile() { '(-f --format)'{-f,--format}'[select the output format]:format:(json)' ) ;; - (path|show) + (path) + opts+=('*:name') + ;; + (show) opts+=( + '(-cx --context)'{-cx,--context}'[context to profile]:context:(host build)' $conan_profile_options[@] ) ;; esac - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 ;; esac -} -(( $+functions[_conan_profile_commands] )) || -_conan_profile_commands() { - local -a commands=( - 'detect:generate a profile using auto-detected values' - 'list:list all profiles in the cache' - 'path:show profile path location' - 'show:show aggregated profiles from the passed arguments' - ) - _describe -t 'commands' "command" commands + return ret } (( $+functions[_conan_remote] )) || From 5d82a3e7249789702342f27ff3acf63fcc32ccbb Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 25 Jun 2026 12:08:38 +0900 Subject: [PATCH 16/21] every functions should return value --- src/_conan | 52 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/src/_conan b/src/_conan index b4f5222..82e13fc 100644 --- a/src/_conan +++ b/src/_conan @@ -110,7 +110,7 @@ _conan() { case $state in command_args) if (( $+functions[_conan_${words[1]}] )); then - _call_function ret _conan_${words[1]} && ret=1 + _call_function ret _conan_${words[1]} && ret=0 fi ;; esac @@ -404,6 +404,7 @@ _conan_inspect() { (( $+functions[_conan_install] )) || _conan_install() { + local ret=1 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 @@ -414,17 +415,23 @@ _conan_install() { $_conan_common_options[@] '(-f --format)'{-f,--format}'[select the output format]:format:(json)' \*{-b,--build}'[optional, specify which packages to build from source]:build' + '--requires[directly provide requires instead of a conanfile]:requires' + '--tool-requires[directly provide tool-requires instead of a conanfile]:tool-requires' + '(-g --generator)'{-g,--generator}'[generators to use]:generator:($generators)' + '(-of --output)'{-of,--output-folder}'[the root output folder for generated and build files]:dir:_files -/' + '(-d --deployer)'{-d,--deployer}'[deploy using the provided deployer to the output folder]:deployer:(full_deploy direct_deploy runtime_deploy)' + '--deployer-folder[deployer output folder]:folder:_files -/' + '*--deployer-packge[execute the deploy() method of the packages matching the provided patterns]:pattern' + '--build-require[whether the provided path is a build-require]' + '--envs-generation[generation strategy for virtual environment files for the root]:bool:(false)' $_conan_remote_options[@] - '(-u --update)'{-u,--update}'[will check the remote and in case a newer version]' $conan_profile_options[@] $_conan_lockfile_options[@] - '(-g --generator)'{-g,--generator}"[generators to use]:generator:($generators)" - '(-of --output)'{-of,--output-folder}'[the root output folder for generated and build files]:dir:_files -/' - '--deploy[deploy using the provided deployer to the output folder]:deployer' '1:recipe_dir_or_conanfile:_files' ) - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 + return ret } (( $+functions[_conan_list] )) || @@ -719,26 +726,35 @@ _conan_remote() { (( $+functions[_conan_remove] )) || _conan_remove() { + local ret=1 local -a opts=( $_conan_common_options[@] + '(-f --format)'{-f,--format}'[select the output format]:format:(json)' '(-c --confirm)'{-c,--confirm}'[remove without requesting a confirmation]' \*{-p,--package-query}'[remove only the packages matching a specific query]:query' \*{-r,--remote}'[will remove from the specified remote]:remote' + \*{-l,--list}'[package list file]:list:_files' + '--lru[remove recipes and binaries that have not been recently used]:lru' + '--dry-run[do not remove any items, only print those which would be removed]' '*:recipe_or_package_reference:_files' ) - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 + return ret } (( $+functions[_conan_search] )) || _conan_search() { + local ret=1 local -a opts=( $_conan_common_options[@] + '(-f --format)'{-f,--format}'[select the output format]:format:(json)' \*{-r,--remote}'[will remove from the specified remote]:remote' '*:recipe_reference:_files' ) - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 + return ret } (( $+functions[_conan_version] )) || @@ -869,8 +885,10 @@ _conan_editable() { (( $+functions[_conan_export] )) || _conan_export() { + local ret=1 local -a opts=( $_conan_common_options[@] + '(-f --format)'{-f,--format}'[select output format]:format:(json pkglist)' '(-r --remote -nr --no-remote)'{-r,--remote}'[remote names. Accepts wildcards("*")]:remote' '(-r --remote -nr --no-remote)'{-nr,--no-remote}'[do not use remote]' '(-l --lockfile)'{-l,--lockfile}'[path to a lockfile]:file:_files' @@ -881,7 +899,8 @@ _conan_export() { '*: :_files -/' ) - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 + return ret } (( $+functions[_conan_export-pkg] )) || @@ -907,7 +926,7 @@ _conan_export-pkg() { (( $+functions[_conan_require] )) || _conan_require() { - local context state state_descr line ret=1 + local curcontext=$curcontext state state_descr line ret=1 typeset -A opt_args _arguments -C \ @@ -977,33 +996,37 @@ _conan_new() { (( $+functions[_conan_source] )) || _conan_source() { + local ret=1 local -a opts=( $_conan_common_options[@] $conan_reference_options[@] '1: :_files' ) - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 + return ret } (( $+functions[_conan_test] )) || _conan_test() { + local ret=1 local -a opts=( $_conan_common_options[@] \*{-b,--build}'[optional, specify which packages to build from source]:build' $_conan_remote_options[@] - '(-u --update)'{-u,--update}'[will check the remote and in case a newer version]' $conan_profile_options[@] $_conan_lockfile_options[@] '1:path:_files -/' '2:reference' ) - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 + return ret } (( $+functions[_conan_upload] )) || _conan_upload() { + local ret=1 local -a opts=( $_conan_common_options[@] \*{-p,--package-query}'[only upload packages matching a specific query]:query' @@ -1019,7 +1042,8 @@ _conan_upload() { '1::reference' ) - _arguments "$opts[@]" + _arguments "$opts[@]" && ret=0 + return ret } # From 3340a40f642f39a86155ace1b650d1335e5cae79 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 25 Jun 2026 12:10:17 +0900 Subject: [PATCH 17/21] Avoid using global variables, use local variables instead --- src/_conan | 168 ++++++++++++++++++++++++++--------------------------- 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/src/_conan b/src/_conan index 82e13fc..5e650f9 100644 --- a/src/_conan +++ b/src/_conan @@ -39,41 +39,27 @@ # # ------------------------------------------------------------------------------ -_conan_common_options=( - '(- *)'{-h,--help}'[show help message and exit]' - '-v[verbose output]' - '-vquiet[verbose level quiet]' - '-verror[verbose level error]' - '-vwarning[verbose level warning]' - '-vnotice[verbose level notice]' - '-vstatus[verbose level status]' - '-vverbose[verbose level verbose]' - '-vv[more verbose output]' - '-vdebug[verbose level debug]' - '-vvv[more and more verbose output]' - '-vtrace[verbose level trace]' - '--out-file[write the output of the command to the specified file instead of stdout]:file:_files' - \*{-cc,--core-conf}'[define core configuration, overwriting global.conf values]:value' -) - -_conan_lockfile_options=( - '(-l --lockfile)'{-l,--lockfile}'[path to a lockfile]: :_files' - '--lockfile-partial[do not raise an error if some dependency is not found in lockfile]' - '--lockfile-out[filename of the updated lockfile]: :_files' - '--lockfile-clean[remove unused entries from the lockfile]' - '*--lockfile-overrides[overwrite lockfile overrides]:overrides' -) - -_conan_remote_options=( - '(-r --remote -nr --no-remote)'{-r,--remote}'[look in the specified remote server]:remote' - '(-r --remote -nr --no-remote)'{-nr,--no-remote}'[do not use remote, resolve exclusively in the cache]' - \*{-u,--update}'[will install newer versions for the given references]:update' -) - _conan() { local context state state_descr line ret=1 typeset -A opt_args + local -a conan_common_options=( + '(- *)'{-h,--help}'[show help message and exit]' + '-v[verbose output]' + '-vquiet[verbose level quiet]' + '-verror[verbose level error]' + '-vwarning[verbose level warning]' + '-vnotice[verbose level notice]' + '-vstatus[verbose level status]' + '-vverbose[verbose level verbose]' + '-vv[more verbose output]' + '-vdebug[verbose level debug]' + '-vvv[more and more verbose output]' + '-vtrace[verbose level trace]' + '--out-file[write the output of the command to the specified file instead of stdout]:file:_files' + \*{-cc,--core-conf}'[define core configuration, overwriting global.conf values]:value' + ) + local -a conan_reference_options=( '--name[provide a package name if not specified in conanfile]:name' '--version[provide a package version if not specified in conanfile]:version' @@ -100,6 +86,20 @@ _conan() { '(-c\:a --conf\:all)'{-c\\:a,--conf\\:all}'[apply the specified conf all]:conf_all' ) + local -a conan_lockfile_options=( + '(-l --lockfile)'{-l,--lockfile}'[path to a lockfile]: :_files' + '--lockfile-partial[do not raise an error if some dependency is not found in lockfile]' + '--lockfile-out[filename of the updated lockfile]: :_files' + '--lockfile-clean[remove unused entries from the lockfile]' + '*--lockfile-overrides[overwrite lockfile overrides]:overrides' + ) + + local -a conan_remote_options=( + '(-r --remote -nr --no-remote)'{-r,--remote}'[look in the specified remote server]:remote' + '(-r --remote -nr --no-remote)'{-nr,--no-remote}'[do not use remote, resolve exclusively in the cache]' + \*{-u,--update}'[will install newer versions for the given references]:update' + ) + _arguments -C \ '(- : *)'{-h,--help}'[display help information]' \ '(- : *)'{-v,--version}'[display version information]' \ @@ -169,7 +169,7 @@ _conan_cache() { typeset -A opt_args _arguments -C \ - $_conan_common_options[@] \ + $conan_common_options[@] \ '1:subcommand:->subcommand' \ '*:: :->args' \ && ret=0 @@ -190,7 +190,7 @@ _conan_cache() { _describe -t 'commands' "command" commands && ret=0 ;; (args) - local -a opts=($_conan_common_options[@]) + local -a opts=($conan_common_options[@]) case $words[1] in (check-integrity|sign|verify) opts+=( @@ -270,7 +270,7 @@ _conan_config() { _describe -t 'commands' "command" commands && ret=0 ;; (args) - local -a opts=($_conan_common_options[@]) + local -a opts=($conan_common_options[@]) case $words[1] in (install) opts+=( @@ -330,17 +330,17 @@ _conan_graph() { _describe -t 'commands' "command" commands && ret=0 ;; (args) - local -a opts=($_conan_common_options[@]) + local -a opts=($conan_common_options[@]) case $words[1] in (build-order|explain|info|outdated) opts+=( \*{-b,--build}'[optional, specify which packages to build from source]:build' '--requires[directly provide requires instead of a conanfile]:requires' '--tool-requires[directly provide tool-requires instead of a conanfile]:tool-requires' - $_conan_remote_options[@] + $conan_remote_options[@] $conan_profile_options[@] $conan_reference_options[@] - $_conan_lockfile_options[@] + $conan_lockfile_options[@] '*:folder:_files -/' ) ;| @@ -390,7 +390,7 @@ _conan_inspect() { local ret=1 _arguments \ - $_conan_common_options[@] \ + $conan_common_options[@] \ '(-f --format)'{-f,--format}'[select the output format]:format:(json)' \ '(-r --remote -nr --no-remote)'{-r,--remote}'[remote names. Accepts wildcards("*")]:remote' \ '(-r --remote -nr --no-remote)'{-nr,--no-remote}'[do not use remote]' \ @@ -412,7 +412,7 @@ _conan_install() { virtualrunenv youcompleteme txt json premake make markdown deploy ) local -a opts=( - $_conan_common_options[@] + $conan_common_options[@] '(-f --format)'{-f,--format}'[select the output format]:format:(json)' \*{-b,--build}'[optional, specify which packages to build from source]:build' '--requires[directly provide requires instead of a conanfile]:requires' @@ -424,9 +424,9 @@ _conan_install() { '*--deployer-packge[execute the deploy() method of the packages matching the provided patterns]:pattern' '--build-require[whether the provided path is a build-require]' '--envs-generation[generation strategy for virtual environment files for the root]:bool:(false)' - $_conan_remote_options[@] + $conan_remote_options[@] $conan_profile_options[@] - $_conan_lockfile_options[@] + $conan_lockfile_options[@] '1:recipe_dir_or_conanfile:_files' ) @@ -438,7 +438,7 @@ _conan_install() { _conan_list() { local ret=1 local -a opts=( - $_conan_common_options[@] + $conan_common_options[@] '(-f --format)'{-f,--format}'[select the output format]:format:(json html compact)' \*{-p,--package-query}'[remove only the packages matching a specific query]:query' \*{-fp,--filter-profile}'[profiles to filter the binaries]:filter_profile' @@ -482,7 +482,7 @@ _conan_lock() { _describe -t 'commands' "command" commands && ret=0 ;; (args) - local -a opts=($_conan_common_options) + local -a opts=($conan_common_options) case $words[1] in (add) opts+=( @@ -499,10 +499,10 @@ _conan_lock() { '--requires[directly provide requires instead of a conanfile]:requires' '--tool-requires[directly provide tool-requires instead of a conanfile]:tool-requires' '--build-require[whether the provided reference is a build-require]' - $_conan_remote_options[@] + $conan_remote_options[@] $conan_profile_options[@] $conan_reference_options[@] - $_conan_lockfile_options[@] + $conan_lockfile_options[@] '1: :_files' ) ;; @@ -539,10 +539,10 @@ _conan_lock() { \*{-ubr,--update-build-requires}'[update build-requires from lockfile]:update_build_requires' \*{-upr,--update-python-requires}'[update python-requires from lockfile]:update_python_requires' '*--build-requires[update build-requires from lockfile]:build_requires' - $_conan_remote_options[@] + $conan_remote_options[@] $conan_profile_options[@] $conan_reference_options[@] - $_conan_lockfile_options[@] + $conan_lockfile_options[@] ) ;; (upgrade-config) @@ -550,10 +550,10 @@ _conan_lock() { '--requires[directly provide requires instead of a conanfile]:requires' '--tool-requires[directly provide tool-requires instead of a conanfile]:tool-requires' '*--update-config-requires[update config-requires from lockfile]:update_config_requires' - $_conan_remote_options[@] + $conan_remote_options[@] $conan_profile_options[@] $conan_reference_options[@] - $_conan_lockfile_options[@] + $conan_lockfile_options[@] ) ;; esac @@ -587,7 +587,7 @@ _conan_profile() { _describe -t 'commands' "command" commands && ret=0 ;; (args) - local opts=($_conan_common_options[@]) + local opts=($conan_common_options[@]) case $words[1] in (detect) opts+=( @@ -625,7 +625,7 @@ _conan_remote() { typeset -A opt_args _arguments -C \ - $_conan_common_options[@] \ + $conan_common_options[@] \ '1:subcommand:->subcommand' \ '*:: :->args' \ && ret=0 @@ -649,7 +649,7 @@ _conan_remote() { _describe -t 'commands' "command" commands && ret=0 ;; (args) - local -a opts=($_conan_common_options[@]) + local -a opts=($conan_common_options[@]) case $words[1] in (add) opts+=( @@ -728,7 +728,7 @@ _conan_remote() { _conan_remove() { local ret=1 local -a opts=( - $_conan_common_options[@] + $conan_common_options[@] '(-f --format)'{-f,--format}'[select the output format]:format:(json)' '(-c --confirm)'{-c,--confirm}'[remove without requesting a confirmation]' \*{-p,--package-query}'[remove only the packages matching a specific query]:query' @@ -747,7 +747,7 @@ _conan_remove() { _conan_search() { local ret=1 local -a opts=( - $_conan_common_options[@] + $conan_common_options[@] '(-f --format)'{-f,--format}'[select the output format]:format:(json)' \*{-r,--remote}'[will remove from the specified remote]:remote' '*:recipe_reference:_files' @@ -761,7 +761,7 @@ _conan_search() { _conan_version() { local ret=1 _arguments \ - $_conan_common_options[@] \ + $conan_common_options[@] \ '(-f --format)'{-f,--format}'[select the output format]:format:(json)' \ && ret=0 @@ -777,7 +777,7 @@ _conan_build() { local ret=1 local -a opts=( - $_conan_common_options[@] + $conan_common_options[@] \*{-g,--generator}'[generators to use]:generator' '(-of --output-folder)'{-of,--output-folder}'[root output folder for generated and build files]:folder:_files -/' '(-d --deployer)'{-d,--deployer}'[deploy using the provided deployer to the output folder]:deployer:(full_deploy direct_deploy)' @@ -786,9 +786,9 @@ _conan_build() { '--envs-generation[generation strategy for virtual environment files for the root]:flag:(false)' \*{-b,--build}'[optional, specify which packages to build from source]:build' $conan_reference_options[@] - $_conan_remote_options[@] + $conan_remote_options[@] $conan_profile_options[@] - $_conan_lockfile_options[@] + $conan_lockfile_options[@] '*: :_files' ) @@ -800,14 +800,14 @@ _conan_build() { _conan_create() { local ret=1 local -a opts=( - $_conan_common_options[@] + $conan_common_options[@] \*{-b,--build}'[optional, specify which packages to build from source]:build' '(-u --update)'{-u,--update}'[will check the remote and in case a newer version]' '--build-require[whether the provided reference is a build-require]' '(-tf --test-folder)'{-tf,--test-folder}'[alternative test folder name]:folder:_files -/' $conan_reference_options[@] - $_conan_lockfile_options[@] - $_conan_remote_options[@] + $conan_lockfile_options[@] + $conan_remote_options[@] $conan_profile_options[@] '*: :_files -/' ) @@ -820,7 +820,7 @@ _conan_create() { _conan_download() { local ret=1 local -a opts=( - $_conan_common_options[@] + $conan_common_options[@] '--only-recipe[download only the recipe, not the binary packages]' \*{-p,--package-query}'[only download packages matching a specific query]:query' '(-r --remote)'{-r,--remote}'[download from the specific remote]:remote:_conan_remotes' @@ -839,7 +839,7 @@ _conan_editable() { typeset -A opt_args _arguments -C \ - $_conan_common_options[@] \ + $conan_common_options[@] \ '1:subcommand:->subcommand' \ '*:: :->args' \ && ret=0 @@ -854,7 +854,7 @@ _conan_editable() { _describe -t 'commands' "command" commands && ret=0 ;; (args) - local opts=($_conan_common_options[@]) + local opts=($conan_common_options[@]) case $words[1] in (add) opts+=( @@ -887,7 +887,7 @@ _conan_editable() { _conan_export() { local ret=1 local -a opts=( - $_conan_common_options[@] + $conan_common_options[@] '(-f --format)'{-f,--format}'[select output format]:format:(json pkglist)' '(-r --remote -nr --no-remote)'{-r,--remote}'[remote names. Accepts wildcards("*")]:remote' '(-r --remote -nr --no-remote)'{-nr,--no-remote}'[do not use remote]' @@ -907,7 +907,7 @@ _conan_export() { _conan_export-pkg() { local ret=1 local -a opts=( - $_conan_common_options[@] + $conan_common_options[@] '(-of --output-folder)'{-of,--output-folder}'[root output folder for generated and build files]:folder:_files -/' '--build-require[whether the provided reference is a build-require]' '(-tf --test-folder)'{-tf,--test-folder}'[alternative test folder name]:folder:_files -/' @@ -915,7 +915,7 @@ _conan_export-pkg() { '(-r --remote -nr --no-remote)'{-r,--remote}'[look in the specified remote or remote servers]:remote' '(-r --remote -nr --no-remote)'{-nr,--no-remote}'[do not use remote]' $conan_reference_options[@] - $_conan_lockfile_options[@] + $conan_lockfile_options[@] $conan_profile_options[@] '*: :_files -/' ) @@ -930,7 +930,7 @@ _conan_require() { typeset -A opt_args _arguments -C \ - $_conan_common_options[@] \ + $conan_common_options[@] \ '1: :->subcommand' \ '*:: :->args' \ && ret=1 @@ -953,7 +953,7 @@ _conan_require() { case $words[1] in (add) _arguments \ - $_conan_common_options[@] \ + $conan_common_options[@] \ $common_options[@] \ '(-r --remote -nr --no-remote)'{-r,--remote}'[remote names. Accepts wildcards("*")]:remote' \ '(-r --remote -nr --no-remote)'{-nr,--no-remote}'[do not use remote]' \ @@ -962,7 +962,7 @@ _conan_require() { ;; (remove) _arguments \ - $_conan_common_options[@] \ + $conan_common_options[@] \ $common_options[@] \ '*::name' \ && ret=0 @@ -983,7 +983,7 @@ _conan_new() { local_recipes_index workspace ) local -a opts=( - $_conan_common_options[@] + $conan_common_options[@] \*{-d,--define}'[define a template argument as key=value]:key_value' '(-f --force)'{-f,--force}'[overwrite file if it already exists]' '(-o --output)'{-o,--output}'[output folder for the generated files]:folder:_files -/' @@ -998,7 +998,7 @@ _conan_new() { _conan_source() { local ret=1 local -a opts=( - $_conan_common_options[@] + $conan_common_options[@] $conan_reference_options[@] '1: :_files' ) @@ -1011,11 +1011,11 @@ _conan_source() { _conan_test() { local ret=1 local -a opts=( - $_conan_common_options[@] + $conan_common_options[@] \*{-b,--build}'[optional, specify which packages to build from source]:build' - $_conan_remote_options[@] + $conan_remote_options[@] $conan_profile_options[@] - $_conan_lockfile_options[@] + $conan_lockfile_options[@] '1:path:_files -/' '2:reference' ) @@ -1028,7 +1028,7 @@ _conan_test() { _conan_upload() { local ret=1 local -a opts=( - $_conan_common_options[@] + $conan_common_options[@] \*{-p,--package-query}'[only upload packages matching a specific query]:query' '(-r --remote)'{-r,--remote}'[upload to this specific remote]:remote:_conan_remotes' '--only-recipe[upload only the recipe, not the binary packages]' @@ -1056,7 +1056,7 @@ _conan_audit() { typeset -A opt_args _arguments -C \ - $_conan_common_options[@] \ + $conan_common_options[@] \ '1: :->subcommand' \ '*:: :->args' \ && ret=1 @@ -1074,7 +1074,7 @@ _conan_audit() { case $words[1] in (list) _arguments \ - $_conan_common_options[@] \ + $conan_common_options[@] \ '(-f --format)'{-f,--format}'[select the output format]:format:(json html)' \ '(-l --list)'{-l,--list}'[package list file to list vulnerabilities for]:list:_files' \ '(-s --sbom)'{-s,--sbom}'[SBOM file to list vulnerabilities for]:sbom:_files' \ @@ -1086,7 +1086,7 @@ _conan_audit() { ;; (provider) _arguments \ - $_conan_common_options[@] \ + $conan_common_options[@] \ '(-f --format)'{-f,--format}'[select the output format]:format:(json html)' \ '--url[provider URL]:url' \ '--type[provider type]:type:(conan-center-proxy private)' \ @@ -1097,17 +1097,17 @@ _conan_audit() { ;; (scan) _arguments \ - $_conan_common_options[@] \ + $conan_common_options[@] \ \*{-b,--build}'[specify which packages to build from source]:build:(never missing cascade)' \ '--requires[directly provide requires instead of a conanfile]:requires' \ '--tool-requires[directly provide tool-requires instead of a conanfile]:tool-requires' \ '(-sl --severity-level)'{-sl,--severity-level}'[set threshold for severity level to raise an error]:level' \ '--context[context to scan]:context:(host build)' \ '(-p --provider)'{-p,--provider}'[provider to use for scanning]' \ - $_conan_remote_options[@] \ + $conan_remote_options[@] \ $conan_profile_options[@] \ $conan_reference_options[@] \ - $_conan_lockfile_options[@] \ + $conan_lockfile_options[@] \ && ret=0 ;; esac @@ -1123,7 +1123,7 @@ _conan_report() { typeset -A opt_args _arguments -C \ - $_conan_common_options[@] \ + $conan_common_options[@] \ '1: :->subcommand' \ '*:: :->args' \ && ret=1 @@ -1139,7 +1139,7 @@ _conan_report() { case $words[1] in (diff) _arguments \ - $_conan_common_options[@] \ + $conan_common_options[@] \ '(-op --old-path)'{-op,--old-path}'[path to the old recipe]:path:_files' \ '(-or --old-reference)'{-or,--old-reference}'[old reference]:reference' \ '(-np --new-path)'{-np,--new-path}'[path to the new recipe]:path:_files' \ From 97e0c82d2cd81a858234d387711ae2498eb7222a Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 25 Jun 2026 12:11:09 +0900 Subject: [PATCH 18/21] update version --- src/_conan | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_conan b/src/_conan index 5e650f9..bff05bc 100644 --- a/src/_conan +++ b/src/_conan @@ -28,7 +28,7 @@ # Description # ----------- # -# Completion script for conan 2.0.0 (https://conan.io). +# Completion script for conan 2.29.1 (https://conan.io). # # ------------------------------------------------------------------------------ # Authors From 473f4d9d195c4bd2192d901786d04ee0acfa51fe Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 25 Jun 2026 12:13:31 +0900 Subject: [PATCH 19/21] fix typo --- src/_conan | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/_conan b/src/_conan index bff05bc..3f8508b 100644 --- a/src/_conan +++ b/src/_conan @@ -323,7 +323,7 @@ _conan_graph() { local -a commands=( 'build-order:compute the build order of a dependency graph' 'build-order-merge:merge more than 1 build-order file' - 'explain:explan what is wrong with the dependency graph' + 'explain:explain what is wrong with the dependency graph' 'info:compute the dependency graph and shows information about it' 'outdated:list the dependencies in the graph and it is newer versions in the remote' ) @@ -395,7 +395,7 @@ _conan_inspect() { '(-r --remote -nr --no-remote)'{-r,--remote}'[remote names. Accepts wildcards("*")]:remote' \ '(-r --remote -nr --no-remote)'{-nr,--no-remote}'[do not use remote]' \ '(-l --lockfile)'{-l,--lockfile}'[path to a lockfile]:path:_files' \ - '--lockfile-partial[do not raise an error if some dependnecy is not found in lockfile]' \ + '--lockfile-partial[do not raise an error if some dependency is not found in lockfile]' \ '*:recipe_folder:_files -/' \ && ret=0 @@ -421,7 +421,7 @@ _conan_install() { '(-of --output)'{-of,--output-folder}'[the root output folder for generated and build files]:dir:_files -/' '(-d --deployer)'{-d,--deployer}'[deploy using the provided deployer to the output folder]:deployer:(full_deploy direct_deploy runtime_deploy)' '--deployer-folder[deployer output folder]:folder:_files -/' - '*--deployer-packge[execute the deploy() method of the packages matching the provided patterns]:pattern' + '*--deployer-package[execute the deploy() method of the packages matching the provided patterns]:pattern' '--build-require[whether the provided path is a build-require]' '--envs-generation[generation strategy for virtual environment files for the root]:bool:(false)' $conan_remote_options[@] From 33a54893e34a21a0019ad933c1706f7f139cc3d4 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 25 Jun 2026 14:46:23 +0900 Subject: [PATCH 20/21] fix missing argument parameters --- src/_conan | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/_conan b/src/_conan index 3f8508b..774a021 100644 --- a/src/_conan +++ b/src/_conan @@ -279,6 +279,7 @@ _conan_config() { \*{-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 -/' + '*:item:_files' ) ;; (install-pkg) @@ -292,11 +293,13 @@ _conan_config() { '(-pr --profile)'{-pr,--profile}'[profile to install config]:profile' '(-s --settings)'{-s,--settings}'[settings to install config]:settings' '(-o --options)'{-o,--options}'[options to install config]:options' + '*:package_reference' ) ;; (list|show) opts+=( '(-f --format)'{-f,--format}'[select the output format]:format:(json)' + '*:pattern' ) ;; esac @@ -367,6 +370,7 @@ _conan_graph() { '*--package-filter[print information only for packages that match the patterns]:pattern' '(-d --deployer)'{-d,--deployer}'[deploy using the provided deployer to the output folder]:deployer:(full_deploy direct_deploy)' '(-df --deployer-folder)'{-df,--deployer-folder}'[deployer output folder]:folder:_files -/' + '*:path:_files' ) ;; (build-order-merge) @@ -543,6 +547,7 @@ _conan_lock() { $conan_profile_options[@] $conan_reference_options[@] $conan_lockfile_options[@] + '*:path:_files' ) ;; (upgrade-config) @@ -554,6 +559,7 @@ _conan_lock() { $conan_profile_options[@] $conan_reference_options[@] $conan_lockfile_options[@] + '*:path:_files' ) ;; esac @@ -1108,6 +1114,7 @@ _conan_audit() { $conan_profile_options[@] \ $conan_reference_options[@] \ $conan_lockfile_options[@] \ + '*::path:_files' \ && ret=0 ;; esac From 46d0330c993e7750ceadaeb05e511f1a81f68add Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Fri, 26 Jun 2026 10:14:46 +0900 Subject: [PATCH 21/21] Fix claude pointing outs --- src/_conan | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/_conan b/src/_conan index 774a021..6f8e0ff 100644 --- a/src/_conan +++ b/src/_conan @@ -71,7 +71,7 @@ _conan() { '(-pr --profile)'{-pr,--profile}'[apply the specified profile]:profile' '(-pr\:b --profile\:build)'{-pr\\:b,--profile\\:build}'[apply the specified profile build]:profile_build' '(-pr\:h --profile\:host)'{-pr\\:h,--profile\\:host}'[apply the specified profile host]:profile_host' - '(-pr\:a --profile\:all)'{-pr\\:a,--profile\\:apply}'[apply the specified profile all]:profile_all' + '(-pr\:a --profile\:all)'{-pr\\:a,--profile\\:all}'[apply the specified profile all]:profile_all' '(-o --options)'{-o,--options}'[apply the specified options]:options' '(-o\:b --options\:build)'{-o\\:b,--options\\:build}'[apply the specified options build]:options_build' '(-o\:h --options\:host)'{-o\\:h,--options\\:host}'[apply the specified options host]:options_host' @@ -79,7 +79,7 @@ _conan() { '(-s --settings)'{-s,--settings}'[apply the specified settings]:settings' '(-s\:b --settings\:build)'{-s\\:b,--settings\\:build}'[apply the specified settings build]:settings_build' '(-s\:h --settings\:host)'{-s\\:h,--settings\\:host}'[apply the specified settings host]:settings_host' - '(-s\:a --settings:all)'{-s\\:a,--settings\\:all}'[apply the specified settings all]:settings_all' + '(-s\:a --settings\:all)'{-s\\:a,--settings\\:all}'[apply the specified settings all]:settings_all' '(-c --conf)'{-c,--conf}'[apply the specified conf]:conf' '(-c\:b --conf\:build)'{-c\\:b,--conf\\:build}'[apply the specified conf build]:conf_build' '(-c\:h --conf\:host)'{-c\\:h,--conf\\:host}'[apply the specified conf host]:conf_host' @@ -283,7 +283,7 @@ _conan_config() { ) ;; (install-pkg) - opts++( + opts+=( '(-l --lockfile)'{-l,--lockfile}'[path to a lockfile]:file:_files' '--lockfile-partial[do not raise an error if some dependency is not found in lockfile]' '--lockfile-out[file name of the updated lockfile]:file:_files' @@ -422,7 +422,7 @@ _conan_install() { '--requires[directly provide requires instead of a conanfile]:requires' '--tool-requires[directly provide tool-requires instead of a conanfile]:tool-requires' '(-g --generator)'{-g,--generator}'[generators to use]:generator:($generators)' - '(-of --output)'{-of,--output-folder}'[the root output folder for generated and build files]:dir:_files -/' + '(-of --output-folder)'{-of,--output-folder}'[the root output folder for generated and build files]:dir:_files -/' '(-d --deployer)'{-d,--deployer}'[deploy using the provided deployer to the output folder]:deployer:(full_deploy direct_deploy runtime_deploy)' '--deployer-folder[deployer output folder]:folder:_files -/' '*--deployer-package[execute the deploy() method of the packages matching the provided patterns]:pattern' @@ -564,7 +564,7 @@ _conan_lock() { ;; esac - _arguments "$opts[@]" && ret=1 + _arguments "$opts[@]" && ret=0 ;; esac @@ -939,7 +939,7 @@ _conan_require() { $conan_common_options[@] \ '1: :->subcommand' \ '*:: :->args' \ - && ret=1 + && ret=0 case $state in (subcommand) @@ -1065,7 +1065,7 @@ _conan_audit() { $conan_common_options[@] \ '1: :->subcommand' \ '*:: :->args' \ - && ret=1 + && ret=0 case $state in (subcommand) @@ -1133,7 +1133,7 @@ _conan_report() { $conan_common_options[@] \ '1: :->subcommand' \ '*:: :->args' \ - && ret=1 + && ret=0 case $state in (subcommand) @@ -1166,7 +1166,7 @@ _conan_report() { # (( $+functions[_conan_remotes] )) || _conan_remotes() { - local -a remotes=(${(f)"$(_call_program remotes $service remote list)"}) + local -a remotes=(${${(f)"$(_call_program remotes $service remote list 2>/dev/null)"}%%:*}) _describe -t remotes 'remote' remotes "$@" }