update 'graph' command completion

This commit is contained in:
Shohei YOSHIDA 2026-06-24 09:55:02 +09:00
parent 6ff45c8fc7
commit 64e9cc76db
No known key found for this signature in database
GPG Key ID: C9A1BB11BB940CF2
1 changed files with 52 additions and 33 deletions

View File

@ -319,60 +319,79 @@ _conan_config() {
(( $+functions[_conan_graph] )) || (( $+functions[_conan_graph] )) ||
_conan_graph() { _conan_graph() {
_arguments -C \ local curcontext=$curcontext state state_descr line ret=1
'(- : *)'{-h,--help}'[display help information]' \ typeset -A opt_args
'1: :_conan_graph_commands' \
'*:: :->args'
local -a common_opts=( _arguments -C \
$_conan_package_options[@] '1:subcommand:->subcommand' \
\*{-b,--build}'[optional, specify which packages to build from source]:build' '*:: :->args' \
$_conan_remote_options[@] && ret=0
'(-u --update)'{-u,--update}'[will check the remote and in case a newer version]'
$conan_profile_options[@]
$_conan_lockfile_options[@]
)
case $state in 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) (args)
local -a opts=($_conan_common_options[@]) local -a opts=($_conan_common_options[@])
case $words[1] in case $words[1] in
(build-order) (build-order|explain|info|outdated)
opts+=( opts+=(
'(-f --format)'{-f,--format}'[select the output format]:format:(json)' \*{-b,--build}'[optional, specify which packages to build from source]:build'
$common_opts[@] '--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+=( 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) (info)
opts+=( opts+=(
$common_opts[@] '*--filter[show only the specified fields]:pattern'
'(-f --format)'{-f,--format}'[select the output format]:format:(html json dot)' '*--package-filter[print information only for packages that match the patterns]:pattern'
'--check-updates[check if there are recipe updates]' '(-d --deployer)'{-d,--deployer}'[deploy using the provided deployer to the output folder]:deployer:(full_deploy direct_deploy)'
'*--filter[show only the specified fields]:filter' '(-df --deployer-folder)'{-df,--deployer-folder}'[deployer output folder]:folder:_files -/'
'*--package-filter[print information only for packages that match the patterns]:package_filter' )
'--deploy[deploy using the provided deployer to the output folder]:deployer' ;;
(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 esac
_arguments "$opts[@]" _arguments "$opts[@]" && ret=0
;; ;;
esac esac
}
(( $+functions[_conan_graph_commands] )) || return ret
_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
} }
(( $+functions[_conan_inspect] )) || (( $+functions[_conan_inspect] )) ||