aboutsummaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-09-23 10:19:56 -0700
committerDylan Baker <dylan@pnwbakers.com>2020-09-23 10:19:56 -0700
commit3afaa879ecea489d4bb9bd0b563a2fafd594a051 (patch)
tree6d10ba913cf7274d8d9874318b9f359473c72238 /data
parentf0db3d37509f755698402b7789662610c6526139 (diff)
downloadmeson-3afaa879ecea489d4bb9bd0b563a2fafd594a051.zip
meson-3afaa879ecea489d4bb9bd0b563a2fafd594a051.tar.gz
meson-3afaa879ecea489d4bb9bd0b563a2fafd594a051.tar.bz2
zsh: add wrap completions
This is still missing completions for promote, but I can't figure out how to find the wraps in subprojects that are not in the parent project when those projects haven't been fetched yet.
Diffstat (limited to 'data')
-rw-r--r--data/shell-completions/zsh/_meson55
1 files changed, 54 insertions, 1 deletions
diff --git a/data/shell-completions/zsh/_meson b/data/shell-completions/zsh/_meson
index 07cbe21..80dc6f6 100644
--- a/data/shell-completions/zsh/_meson
+++ b/data/shell-completions/zsh/_meson
@@ -108,6 +108,21 @@ local -a meson_commands=(
fi
}
+(( $+functions[__meson_wrap_names] )) || __meson_wrap_names() {
+ local rwraps
+ rwraps="$(_call_program meson meson wrap list)"
+ local -a wraps=(${(@f)rwraps})
+ _describe -t wraps "Meson wraps" wraps
+}
+
+(( $+functions[__meson_installed_wraps] )) || __meson_installed_wraps() {
+ if [[ -d "subprojects" ]]; then
+ local rwraps="$(ls subprojects/ | grep '\.wrap$' | cut -d . -f 1)"
+ local -a wraps=(${(@f)rwraps})
+ _describe -t wraps "Meson wraps" wraps
+ fi
+}
+
(( $+functions[_meson_commands] )) || _meson_commands() {
_describe -t commands "Meson subcommands" meson_commands
}
@@ -240,7 +255,45 @@ _arguments \
}
(( $+functions[_meson-wrap] )) || _meson-wrap() {
- # TODO
+ local -a commands=(
+ 'list:list all available wraps'
+ 'search:search the db by name'
+ 'install:install the specified project'
+ 'update:Update a project to its newest available version'
+ 'info:Show info about a wrap'
+ 'status:Show the status of your subprojects'
+ )
+
+ if (( CURRENT == 2 )); then
+ _describe -t commands "Meson subcommands" commands
+ else
+ local curcontext="$curcontext"
+ cmd="${${commands[(r)$words[2]:*]%%:*}}"
+ if (( $#cmd )); then
+ if [[ $cmd == status ]]; then
+ _message "no options"
+ elif [[ $cmd == "list" ]]; then
+ _arguments '*:meson wraps'
+ elif [[ $cmd == "search" ]]; then
+ _arguments '*:meson wraps'
+ elif [[ $cmd == "install" ]]; then
+ _arguments '*:meson wraps:__meson_wrap_names'
+ elif [[ $cmd == "update" ]]; then
+ _arguments '*:meson wraps:__meson_installed_wraps'
+ elif [[ $cmd == "info" ]]; then
+ _arguments '*:meson wraps:__meson_wrap_name'
+ elif [[ $cmd == "status" ]]; then
+ _arguments '*:'
+ elif [[ $cmd == "promote" ]]; then
+ # TODO: how do you figure out what wraps are provided by subprojects if
+ # they haven't been fetched yet?
+ _arguments '*:'
+ fi
+ else
+ _message "unknown meson wrap command: $words[2]"
+ fi
+ fi
+
}
(( $+functions[_meson-dist] )) || _meson-dist() {