From 020e16a2b56f8551d9a6c0b81469790883c9096e Mon Sep 17 00:00:00 2001 From: Liam Beguin Date: Thu, 15 Sep 2022 10:58:43 -0400 Subject: [PATCH] completions: bash: add simple init competion Populate the _meson-init() completion function. Signed-off-by: Liam Beguin --- data/shell-completions/bash/meson | 36 ++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/data/shell-completions/bash/meson b/data/shell-completions/bash/meson index 900498132..4357a3f68 100644 --- a/data/shell-completions/bash/meson +++ b/data/shell-completions/bash/meson @@ -301,7 +301,41 @@ _meson-introspect() { } _meson-init() { - : TODO + shortopts=( + h + C + n + e + e + d + l + b + f + ) + + longopts=( + help + name + executable + deps + language + builddir + force + type + version + ) + + if [[ "$cur" == "--"* ]]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}")) + elif [[ "$cur" == "-"* && ${#cur} -gt 1 ]]; then + COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}")) + else + if [ -z "$cur" ]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}')) + COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}')) + fi + fi + } _meson-test() {