From f031b84aa8f0b95bfa88fc4b54ea8b88bb5ef87d Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Thu, 25 Jun 2026 11:33:41 +0900 Subject: [PATCH] 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] )) ||