diff options
author | Joey Pabalinas <joeypabalinas@gmail.com> | 2024-07-20 04:34:59 -1000 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2024-07-21 17:38:28 -0400 |
commit | 8554699c42faddd1f0775871d6dca8195a366f24 (patch) | |
tree | cf8cb4be50d30573d4f96cf8593e6244d376ebf8 /data | |
parent | 7f5262b483f84c2430f67d48b54e8702ba4b1e27 (diff) | |
download | meson-8554699c42faddd1f0775871d6dca8195a366f24.zip meson-8554699c42faddd1f0775871d6dca8195a366f24.tar.gz meson-8554699c42faddd1f0775871d6dca8195a366f24.tar.bz2 |
zsh: Add completions for {rewrite,devenv,env2mfile,format,help} subcommands
Signed-off-by: Joey Pabalinas <joeypabalinas@gmail.com>
Diffstat (limited to 'data')
-rw-r--r-- | data/shell-completions/zsh/_meson | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/data/shell-completions/zsh/_meson b/data/shell-completions/zsh/_meson index 949f978..a016ce0 100644 --- a/data/shell-completions/zsh/_meson +++ b/data/shell-completions/zsh/_meson @@ -81,6 +81,11 @@ local -a meson_commands=( 'wrap:manage source dependencies' 'subprojects:manage subprojects' 'compile:Build the project' +'rewrite:Modify the project definition' +'devenv:Run commands in developer environment' +'env2mfile:Convert current environment to a cross or native file' +'format:Format meson source file' +'help:Print help of a subcommand' ) (( $+functions[__meson_is_build_dir] )) || __meson_is_build_dir() { @@ -403,6 +408,98 @@ _arguments \ "${(@)specs}" } +# TODO: implement rewrite sub-commands properly +(( $+functions[_meson-rewrite-target] )) || _meson-rewrite-target() { +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ +} + +(( $+functions[_meson-rewrite-kwargs] )) || _meson-rewrite-kwargs() { +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ +} + +(( $+functions[_meson-rewrite-default-options] )) || _meson-rewrite-default-options() { +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ +} + +(( $+functions[_meson-rewrite-command] )) || _meson-rewrite-command() { +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ +} + +(( $+functions[_meson-rewrite] )) || _meson-rewrite() { + local -a commands=( + 'target:Modify a target' + 'kwargs:Modify keyword arguments' + 'default-options:Modify the project default options' + 'command:Execute a JSON array of commands' + ) + + if (( CURRENT == 2 )); then + _describe -t commands "Meson rewrite subcommands" commands + else + local curcontext="$curcontext" + cmd="${${commands[(r)$words[2]:*]%%:*}}" + if [[ $cmd == status ]]; then + _message "no options" + else + _meson-rewrite-$cmd + fi + fi + +} + +(( $+functions[_meson-devenv] )) || _meson-devenv() { + local curcontext="$curcontext" + local -a specs=( + "$__meson_cd" + '--clean=[Clean the build directory]' + '(-w workdir)'{'-w','--workdir'}'=[Directory to cd into before running (default: builddir, Since 1.0.0)]:target dir:_directories' + '--dump=[Only print required environment (Since 0.62.0) Takes an optional file path (Since 1.1.0)]:dump path:_files' + '--dump-format=[Format used with --dump (Since 1.1.0)]:format:(sh export vscode)' + ) +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + "${(@)specs}" +} + +(( $+functions[_meson-env2mfile] )) || _meson-env2mfile() { + local curcontext="$curcontext" + local -a specs=( + '--debarch=[The dpkg architecture to generate.]' + '--gccsuffix=[A particular gcc version suffix if necessary.]' + '-o=[The output file.]:file:_files' + '--cross=[Generate a cross compilation file.]' + '--native=[Generate a native compilation file.]' + '--system=[Define system for cross compilation.]' + '--subsystem=[Define subsystem for cross compilation.]' + '--kernel=[Define kernel for cross compilation.]' + '--cpu=[Define cpu for cross compilation.]' + '--cpu-family=[Define cpu family for cross compilation.]' + '--endian=[Define endianness for cross compilation.]:endianness:(big little)' + ) +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + "${(@)specs}" +} + +(( $+functions[_meson-format] )) || _meson-format() { + local curcontext="$curcontext" + local -a specs=( + '(-q --check-only)'{'-q','--check-only'}'=[exit with 1 if files would be modified by meson format]' + '(-i --inplace)'{'-i','--inplace'}'=[format files in-place]' + '(-r --recursive)'{'-r','--recursive'}'=[recurse subdirs (requires --check-only or --inplace option)]' + '(-c --configuration)'{'-c','--configuration'}'=[read configuration from meson.format]' + '(-e --editor-config)'{'-e','--editor-config'}'=[try to read configuration from .editorconfig]' + '(-o --output)'{'-o','--output'}'=[output file (implies having exactly one input)]' + ) +_arguments \ + '(: -)'{'--help','-h'}'[show a help message and quit]' \ + "${(@)specs}" +} + if [[ $service != meson ]]; then _call_function ret _$service return ret |