diff options
author | Liam Beguin <liambeguin@gmail.com> | 2022-09-05 12:07:03 -0400 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2022-09-18 15:22:48 -0400 |
commit | ebe14848e0b35a879088839ee9a8a1d6e33c952a (patch) | |
tree | 70ba4de70838b80442a168da6bf489dd2e3b318e /data/shell-completions | |
parent | 7e4188a53fdebda6a06b6ac3bd4bc4e51411702d (diff) | |
download | meson-ebe14848e0b35a879088839ee9a8a1d6e33c952a.zip meson-ebe14848e0b35a879088839ee9a8a1d6e33c952a.tar.gz meson-ebe14848e0b35a879088839ee9a8a1d6e33c952a.tar.bz2 |
completions: bash: order function definitions like in help
Move _meson-introspect() to follow the command list defined at the top
of the script which follows the help message order.
Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Diffstat (limited to 'data/shell-completions')
-rw-r--r-- | data/shell-completions/bash/meson | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/data/shell-completions/bash/meson b/data/shell-completions/bash/meson index 993885b..4fbdab1 100644 --- a/data/shell-completions/bash/meson +++ b/data/shell-completions/bash/meson @@ -242,6 +242,50 @@ _meson-configure() { fi } +_meson-introspect() { + shortopts=( + h + ) + + longopts=( + targets + installed + buildsystem-files + buildoptions + tests + benchmarks + dependencies + projectinfo + ) + + local cur prev + if ! _get_comp_words_by_ref cur prev &>/dev/null; then + cur="${COMP_WORDS[COMP_CWORD]}" + fi + + if [[ "$cur" == "--"* ]]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}")) + elif [[ "$cur" == "-"* ]]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}")) + COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}")) + else + for dir in "${COMP_WORDS[@]}"; do + if [ -d "$dir" ]; then + break + fi + dir=. + done + if [ ! -d "$dir/meson-private" ]; then + _filedir -d + fi + + if [ -z "$cur" ]; then + COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}')) + COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}')) + fi + fi +} + _meson-test() { shortopts=( q @@ -367,50 +411,6 @@ for test in json.load(sys.stdin): fi } -_meson-introspect() { - shortopts=( - h - ) - - longopts=( - targets - installed - buildsystem-files - buildoptions - tests - benchmarks - dependencies - projectinfo - ) - - local cur prev - if ! _get_comp_words_by_ref cur prev &>/dev/null; then - cur="${COMP_WORDS[COMP_CWORD]}" - fi - - if [[ "$cur" == "--"* ]]; then - COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}")) - elif [[ "$cur" == "-"* ]]; then - COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}")) - COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}")) - else - for dir in "${COMP_WORDS[@]}"; do - if [ -d "$dir" ]; then - break - fi - dir=. - done - if [ ! -d "$dir/meson-private" ]; then - _filedir -d - fi - - if [ -z "$cur" ]; then - COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}')) - COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}')) - fi - fi -} - _meson-wrap() { : TODO } |