Skip to content

Commit

Permalink
Add wrap set-sources to shell completion scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
klokik committed Dec 2, 2024
1 parent ac530b1 commit 484655e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
23 changes: 23 additions & 0 deletions data/shell-completions/bash/meson
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ _meson-wrap() {
list
promote
search
set-source
status
update
update-db
Expand Down Expand Up @@ -865,6 +866,28 @@ _meson-wrap-search() {
COMPREPLY+=($(compgen -W '${wraps[*]}' -- "$cur"))
}

_meson-wrap-set-source() {
shortopts=(
h
)

longopts=(
help
)

local cur prev
if ! _get_comp_words_by_ref cur prev &>/dev/null; then
cur="${COMP_WORDS[COMP_CWORD]}"
fi

if ! _meson_compgen_options "$cur"; then
if [[ -z $cur ]]; then
COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}'))
COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}'))
fi
fi
}

_meson-wrap-status() {
shortopts=(
h
Expand Down
3 changes: 3 additions & 0 deletions data/shell-completions/zsh/_meson
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ _arguments \
'update:Update a project to its newest available version'
'info:Show info about a wrap'
'status:Show the status of your subprojects'
'set-source:Set WrapDB source URL'
)

if (( CURRENT == 2 )); then
Expand All @@ -297,6 +298,8 @@ _arguments \
# TODO: how do you figure out what wraps are provided by subprojects if
# they haven't been fetched yet?
_arguments '*:'
elif [[ $cmd == "set-source" ]]; then
_arguments '*:'
fi
else
_message "unknown meson wrap command: $words[2]"
Expand Down

0 comments on commit 484655e

Please sign in to comment.