Compare commits

...

5 Commits

Author SHA1 Message Date
Shohei YOSHIDA d1968bd332
Merge pull request #1290 from zsh-users/update-dart-flutter
Update dart flutter
2026-08-17 10:12:03 +09:00
Shohei YOSHIDA 9dc3bf5b3a
Merge pull request #1292 from hetaaaaaaaansh/fix-cmake-find-package-completion
cmake: suggest -D arguments required by --find-package
2026-08-17 09:02:50 +09:00
hetaaaaaaaansh af1db4e3c9 cmake: suggest -D arguments required by --find-package
--find-package (cmake's legacy pkg-config-like mode) silently requires
-DNAME=, -DLANGUAGE=, -DCOMPILER_ID= and -DMODE= to be set, or cmake
aborts with a chain of 'argument not specified' errors (see
Modules/CMakeFindPackageMode.cmake). The completion script gave no
hint that these were needed.

Detect --find-package on the command line and, when present, offer
NAME/LANGUAGE/COMPILER_ID/MODE alongside the usual -D property names,
plus value completion for each (e.g. LANGUAGE -> C/CXX/Fortran,
MODE -> EXIST/COMPILE/LINK).

Fixes #593
2026-08-16 18:08:32 +05:30
Shohei YOSHIDA d2c25c7d0f
update flutter completion to version 3.47.0 2026-08-13 09:45:46 +09:00
Shohei YOSHIDA 345db77abf
update dart completion to version 3.13.0 2026-08-13 09:39:12 +09:00
3 changed files with 132 additions and 8 deletions

View File

@ -614,6 +614,15 @@ _cmake_define_property_names() {
local alternatives=( local alternatives=(
'common-property-names:common property name:_cmake_define_common_property_names -qS=' 'common-property-names:common property name:_cmake_define_common_property_names -qS='
) )
# --find-package (cmake's legacy pkg-config-like mode) requires
# -DNAME=, -DLANGUAGE=, -DCOMPILER_ID= and -DMODE= to be set, see
# Modules/CMakeFindPackageMode.cmake. Suggest them whenever
# --find-package is present on the command line.
if (( ${words[(I)--find-package]} )); then
alternatives+=('find-package-property-names:find-package property name:_cmake_find_package_property_names -qS=')
fi
local -A cmake_langs local -A cmake_langs
zstyle -a ":completion:${curcontext}:" languages cmake_langs zstyle -a ":completion:${curcontext}:" languages cmake_langs
[[ $#cmake_langs -eq 0 ]] && cmake_langs=('C' 'C' 'CXX' 'C++') [[ $#cmake_langs -eq 0 ]] && cmake_langs=('C' 'C' 'CXX' 'C++')
@ -649,6 +658,21 @@ _cmake_define_lang_property_names() {
_describe -t "${cmake_lang//:/-}-property-names" "${cmake_lang_desc} property name" properties $@[0,-3] && return 0 _describe -t "${cmake_lang//:/-}-property-names" "${cmake_lang_desc} property name" properties $@[0,-3] && return 0
} }
# ------------------------------------
# _cmake_find_package_property_names
# ------------------------------------
(( $+functions[_cmake_find_package_property_names] )) ||
_cmake_find_package_property_names() {
local -a properties=(
'NAME:Name of the package to search for, e.g. JPEG'
'LANGUAGE:Language context for the search (C, CXX or Fortran)'
'COMPILER_ID:Compiler identification to use, e.g. GNU'
'MODE:Search mode (EXIST, COMPILE or LINK)'
)
_describe -t 'find-package-property-names' 'find-package property name' properties "$@"
}
# ----------------------------------- # -----------------------------------
# _cmake_define_common_property_names # _cmake_define_common_property_names
# ----------------------------------- # -----------------------------------
@ -710,6 +734,19 @@ _cmake_define_property_values() {
(CMAKE_UNITY_BUILD) (CMAKE_UNITY_BUILD)
_wanted booleans expl 'boolean' _cmake_booleans && ret=0 _wanted booleans expl 'boolean' _cmake_booleans && ret=0
;; ;;
(NAME)
_message -e package-name 'package name to search for, e.g. JPEG' && ret=0
;;
(LANGUAGE)
_wanted languages expl 'language' _values 'language' 'C' 'CXX' 'Fortran' && ret=0
;;
(COMPILER_ID)
_wanted compiler-ids expl 'compiler id' _values 'compiler id' \
'GNU' 'Clang' 'AppleClang' 'MSVC' 'Intel' 'IntelLLVM' 'PGI' 'XL' 'Cray' 'Fujitsu' 'SunPro' 'HP' 'Compaq' 'Borland' 'Watcom' && ret=0
;;
(MODE)
_wanted modes expl 'find-package mode' _values 'mode' 'EXIST' 'COMPILE' 'LINK' && ret=0
;;
(CMAKE_INSTALL_PREFIX) (CMAKE_INSTALL_PREFIX)
_files -/ && ret=0 _files -/ && ret=0
;; ;;

View File

@ -24,7 +24,7 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for dart 3.12.0 (https://dart.dev/) # Completion script for dart 3.13.0 (https://dart.dev/)
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Authors # Authors
@ -60,6 +60,26 @@ _dart() {
'1: :_dart_subcommands' \ '1: :_dart_subcommands' \
&& ret=0 && ret=0
;; ;;
(install)
_arguments \
'(- *)'{-h,--help}'[Print this usage information]' \
'--overwrite[Overwrite executables from other packages with the same name]' \
'*:package' \
&& ret=0
;;
(installed)
_arguments \
'(- *)'{-h,--help}'[Print this usage information]' \
'(-a --all)'{-a,--all}'[Also list packages which are currently not active]'
'*:package' \
&& ret=0
;;
(uninstall)
_arguments \
'(- *)'{-h,--help}'[Print this usage information]' \
'*:package' \
&& ret=0
;;
(analyze) (analyze)
_arguments \ _arguments \
'(- *)'{-h,--help}'[Print this usage information]' \ '(- *)'{-h,--help}'[Print this usage information]' \
@ -69,6 +89,9 @@ _dart() {
'*: :_files -/' \ '*: :_files -/' \
&& ret=0 && ret=0
;; ;;
(build)
_dart_build && ret=0
;;
(compile) (compile)
_dart_compile && ret=0 _dart_compile && ret=0
;; ;;
@ -188,6 +211,47 @@ _dart() {
return ret return ret
} }
(( $+functions[_dart_build] )) ||
_dart_build() {
local ret=1
local -a commands=(
'cli:Build a Dart application with a command line interface (CLI)'
)
_arguments -C \
'(- *)'{-h,--help}'[Show help and usage information]' \
'1: :(($commands))' \
'*:: :->subcmd' && ret=0
case $state in
(subcmd)
local -a options=(
'(- *)'{-h,--help}'[Show help and usage information]'
)
case $words[1] in
(cli)
_arguments \
'(- *)'{-h,--help}'[Show help and usage information]' \
'(-o --output)'{-o,--output=}'[Write the output to <output>/bundle/]:output:_files -/' \
'(-t --target)'{-t,--target=}'[Main entry-point file of the command-line application]:file:_files' \
'(-p --packages)'{-p,--packages=}'[Get package locations from the specified file]:file:_files' \
'--verbosity=[Set the verbosity level of the compilation]:level:(error warning info all)' \
'--depfile=[Path to an output file in Ninja depfile format containing compilation dependencies]:path:_files' \
'--target-sanitizer[Build with a specific target sanitizer]:sanitizer:(none asan msan tsan)' \
'--target-os[Compile to a specific target operating system]:os:(android fuchsia ios linux macos windows)' \
'--target-arch[Compile to a specific target architecture]:arch:(arm arm64 ia32 risv32 riscv64 x64)' \
'--root-package=[Package for which hooks are run are outside the packages in packages argument]:name' \
'*: :_files' \
&& ret=0
;;
esac
;;
esac
return ret
}
(( $+functions[_dart_compile] )) || (( $+functions[_dart_compile] )) ||
_dart_compile() { _dart_compile() {
local ret=1 local ret=1
@ -538,6 +602,13 @@ _dart_pub_cache() {
'(-f --force)'{-f,--force}'[Do not ask for confirmation]' '(-f --force)'{-f,--force}'[Do not ask for confirmation]'
) )
;; ;;
(gc)
opts+=(
'(-f --force)'{-f,--force}'[Prune cache without confirmation]'
'--collect-recent[Also delete recent files]'
'--dry-run[Print list of files that would be deleted]'
)
;;
esac esac
_arguments "$opts[@]" && ret=0 _arguments "$opts[@]" && ret=0
@ -553,6 +624,7 @@ _dart_pub_cache_subcommands() {
"add:Install a package" "add:Install a package"
"clean:Clears the global PUB_CACHE" "clean:Clears the global PUB_CACHE"
"repair:Reinstall cached packages" "repair:Reinstall cached packages"
'gc:Prune unused packages from the system cache'
) )
_describe -t commands 'command' commands "$@" _describe -t commands 'command' commands "$@"
} }
@ -705,17 +777,25 @@ _dart_test_reporter() {
(( $+functions[_dart_subcommands] )) || (( $+functions[_dart_subcommands] )) ||
_dart_subcommands() { _dart_subcommands() {
local -a commands=( local -a commands=(
"analyze:Analyze Dart code in a directory" # global
"install:Install or upgrade a Dart CLI tool for global use"
"installed:List globally installed Dart CLI tools"
"uninstall:Remove aglobally instaled Dart CLI tool"
# project
"build:Build a Dart application including code assets"
"compile:Compile Dart to various formats" "compile:Compile Dart to various formats"
"create:Create a new Dart project" "create:Create a new Dart project"
"devtools:Open DevTools (optionally connecting to an existing application)"
"doc:Generate API documentation for Dart projects"
"fix:Apply automated fixes to Dart source code"
"format:Idiomatically format Dart source code"
"info:Show diagnostic information about the installed tooling"
"pub:Work with packages" "pub:Work with packages"
"run:Run a Dart program" "run:Run a Dart program"
"test:Run tests for a project" "test:Run tests for a project"
# source code
"analyze:Analyze Dart code in a directory"
"doc:Generate API documentation for Dart projects"
"fix:Apply automated fixes to Dart source code"
"format:Idiomatically format Dart source code"
# tools
"devtools:Open DevTools (optionally connecting to an existing application)"
"info:Show diagnostic information about the installed tooling"
) )
_describe -t commands 'command' commands "$@" _describe -t commands 'command' commands "$@"
} }

View File

@ -25,7 +25,7 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for the Flutter.io sdk's cli tool 3.41.1 (https://flutter.dev) # Completion script for the Flutter.io sdk's cli tool 3.47.0 (https://flutter.dev)
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Authors # Authors
@ -150,6 +150,13 @@ _flutter() {
(build) (build)
_flutter_build && ret=0 _flutter_build && ret=0
;; ;;
(clean)
_arguments \
'(- *)'{-h,--help}'[Print this usage information]' \
'--scheme[When cleaning Xcode schemes, clean only the specified scheme]:scheme' \
'--include-example[Also clean the example directory]' \
&& ret=0
;;
(config) (config)
_arguments \ _arguments \
'(- *)'{-h,--help}'[Print this usage information]' \ '(- *)'{-h,--help}'[Print this usage information]' \