From 47f279ca0df3e3a9a5c58d946a1d1fed371ca4f5 Mon Sep 17 00:00:00 2001 From: Shahzeb Siddiqui Date: Wed, 23 Oct 2024 14:07:59 -0400 Subject: [PATCH] update bash completion script by addressing issues reported by shellcheck --- bash_completion.sh | 178 ++++++++++++++++++++++----------------------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/bash_completion.sh b/bash_completion.sh index 0aec5e599..d414e5520 100644 --- a/bash_completion.sh +++ b/bash_completion.sh @@ -193,49 +193,49 @@ _buildtest () local longoption="--account --buildspec --display --dry-run --executor --executor-type --exclude --exclude-tags --filter --helpfilter --limit --maxpendtime --max-jobs --modules --module-purge --name --nodes --pollinterval --procs --profile --rebuild --rerun --remove-stagedir --retry --save-profile --strict --tags --testdir --timeout --unload-modules --validate --write-config-file" local allopts="${longoption} ${shortoption}" - COMPREPLY=( $( compgen -W "$allopts" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$allopts" -- "${cur}" )" ) case "${prev}" in -e|--executor) - COMPREPLY=( $( compgen -W "$(_avail_executors)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_executors)" -- "${cur}" )" ) ;; -et|--executor-type) - COMPREPLY=( $( compgen -W "local batch" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "local batch" -- "${cur}" )" ) ;; -t|--tag|-xt|--exclude-tags) - COMPREPLY=( $( compgen -W "$(_avail_tags)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_tags)" -- "${cur}" )" ) ;; -b|--buildspec|-x|--exclude) - COMPREPLY=( $( compgen -W "$(_avail_buildspecs)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_buildspecs)" -- "${cur}" )" ) ;; -n|--name) - COMPREPLY=( $( compgen -W "$(_buildspec_test_names)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_buildspec_test_names)" -- "${cur}" )" ) ;; esac ;; cd) - COMPREPLY=( $( compgen -W "$(_builder_names)" -- "${cur}" ) );; + COMPREPLY=( "$( compgen -W "$(_builder_names)" -- "${cur}" )" );; clean) local opts="-h --help -y --yes" - COMPREPLY=( $( compgen -W "$opts" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$opts" -- "${cur}" )" ) ;; path) local opts="-b -be -e -h -o -s -t --buildscript --buildenv --errfile --help --outfile --stagedir --testpath" - COMPREPLY=( $( compgen -W "$(_builder_names)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_builder_names)" -- "${cur}" )" ) if [[ $cur == -* ]] ; then - COMPREPLY=( $( compgen -W "$opts" -- $cur ) ) + COMPREPLY=( "$( compgen -W "$opts" -- "${cur}" )" ) fi ;; stats) - COMPREPLY=( $( compgen -W "$(_test_name)" -- "${cur}" ) );; + COMPREPLY=( "$( compgen -W "$(_test_name)" -- "${cur}" )" );; schema) local opts="-h -n -e -j --name --example --json" - COMPREPLY=( $( compgen -W "$opts" -- $cur ) ) + COMPREPLY=( "$( compgen -W "$opts" -- "${cur}" )" ) # fill auto-completion for 'buildtest schema --name' if [[ "${prev}" == "-n" ]] || [[ "${prev}" == "--name" ]]; then - COMPREPLY=( $( compgen -W "$(_avail_schemas)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_schemas)" -- "${cur}" )" ) fi ;; @@ -243,22 +243,22 @@ _buildtest () local opts="--detailed --end --fail --filter --filterfields --format --formatfields --help --helpfilter --helpformat --latest --no-header --oldest --pager --pass --row-count --start --terse -d -e -f -h -n -p -s -t" local cmds="clear list path summary" local aliases="c ls p sm" - COMPREPLY=( $( compgen -W "${cmds} ${aliases}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${cmds} ${aliases}" -- "${cur}" )" ) if [[ $cur == -* ]] ; then - COMPREPLY=( $( compgen -W "$opts" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$opts" -- "${cur}" )" ) fi case "${prev}" in --filter) - COMPREPLY=( $( compgen -W "$(_avail_report_filterfields)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_report_filterfields)" -- "${cur}" )" ) ;; --format) - COMPREPLY=( $( compgen -W "$(_avail_report_formatfields)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_report_formatfields)" -- "${cur}" )" ) ;; summary|sm) local opts="-d -h --detailed --help" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) ;; esac ;; @@ -269,9 +269,9 @@ _buildtest () local aliases="co e ex p v val" local opts="-h --help" - COMPREPLY=( $( compgen -W "${cmds} ${aliases}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${cmds} ${aliases}" -- "${cur}" )" ) if [[ $cur == -* ]] ; then - COMPREPLY=( $( compgen -W "$opts" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$opts" -- "${cur}" )" ) fi # handle completion logic for 'buildtest config ' based on subcommands @@ -281,25 +281,25 @@ _buildtest () local opts="--help -h" local cmds="list find remove test" local aliases="rm" - COMPREPLY=( $( compgen -W "${cmds} ${aliases}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${cmds} ${aliases}" -- "${cur}" )" ) if [[ $cur == -* ]] ; then - COMPREPLY=( $( compgen -W "$opts" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$opts" -- "${cur}" )" ) fi case "${prev}" in list) local opts="--json --yaml -j -y" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) ;; find) local opts="--detailed --file --help --modulepath --update -d -h -m -u" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) ;; remove|rm) - COMPREPLY=( $( compgen -W "$(_avail_compilers)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_compilers)" -- "${cur}" )" ) ;; test) - COMPREPLY=( $( compgen -W "$(_avail_compilers)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_compilers)" -- "${cur}" )" ) ;; esac ;; @@ -309,25 +309,25 @@ _buildtest () case ${COMP_WORDS[3+offset]} in list|ls) local opts="--help --all --disabled --invalid --json --yaml -a -d -h -i -j -y" - COMPREPLY=( $( compgen -W "$opts" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$opts" -- "${cur}" )" ) ;; rm|remove) - COMPREPLY=( $( compgen -W "$(_all_executors)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_all_executors)" -- "${cur}" )" ) ;; *) - COMPREPLY=( $( compgen -W "${cmds}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${cmds}" -- "${cur}" )" ) ;; esac ;; validate|systems) local opts="-h --help" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) );; + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" );; view|v) local opts="--help --pager --theme -h" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) case "${prev}" in --theme) - COMPREPLY=( $( compgen -W "$(_avail_color_themes)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_color_themes)" -- "${cur}" )" ) ;; esac ;; @@ -335,21 +335,21 @@ _buildtest () local opts="--help -h" local cmds="list remove" local aliases="ls rm" - COMPREPLY=( $( compgen -W "${cmds} ${aliases}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${cmds} ${aliases}" -- "${cur}" )" ) if [[ $cur == -* ]] ; then - COMPREPLY=( $( compgen -W "$opts" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$opts" -- "${cur}" )" ) fi case "${prev}" in remove|rm) - COMPREPLY=( $( compgen -W "$(_avail_profiles)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_profiles)" -- "${cur}" )" ) ;; list|ls) local opts="--json --theme --yaml -j -y" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) ;; --theme) - COMPREPLY=( $( compgen -W "$(_avail_color_themes)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_color_themes)" -- "${cur}" )" ) ;; esac ;; @@ -357,37 +357,37 @@ _buildtest () ;; inspect|it) local cmds="--help -h b buildspec ls list n name q query" - COMPREPLY=( $( compgen -W "${cmds}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${cmds}" -- "${cur}" )" ) # case statement to handle completion for buildtest inspect [name|id|list] command case "${COMP_WORDS[2+offset]}" in list|ls) local opts="--builder --help --no-header --pager --row-count --terse -b -h -n" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) );; + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" );; name|n) - COMPREPLY=( $( compgen -W "$(_test_name)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_test_name)" -- "${cur}" )" ) if [[ $cur == -* ]] ; then local opts="--help --pager -h" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) fi ;; buildspec|b) - COMPREPLY=( $( compgen -W "$(_test_buildspec)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_test_buildspec)" -- "${cur}" )" ) if [[ $cur == -* ]] ; then local opts="--all --help --pager -a -h" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) fi ;; query|q) - COMPREPLY=( $( compgen -W "$(_builder_names)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_builder_names)" -- "${cur}" )" ) if [[ $cur == -* ]] ; then local opts="--buildscript --buildenv --error --help --output --pager --testpath --theme -b -be -e -o -h -o -t" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) fi case "${prev}" in --theme) - COMPREPLY=( $( compgen -W "$(_avail_color_themes)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_color_themes)" -- "${cur}" )" ) return esac ;; @@ -397,10 +397,10 @@ _buildtest () local cmds="edit-file edit-test find maintainers show show-fail summary validate" local aliases="ef et f m s sf sm val" local opts="-h --help" - COMPREPLY=( $( compgen -W "${cmds} ${aliases}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${cmds} ${aliases}" -- "${cur}" )" ) if [[ $cur == -* ]] ; then - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) fi # switch based on 2nd word 'buildtest buildspec ' @@ -410,21 +410,21 @@ _buildtest () # completion for 'buildtest buildspec find invalid' invalid) local opts="--error --help --pager --row-count --terse -e -h" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) );; + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" );; # completion for rest of arguments *) local longopts="--buildspec --count --executors --filter --filterfields --format --formatfields --group-by-executor --group-by-tags --help --helpfilter --helpformat --no-header --pager --paths --quiet --rebuild --row-count --search --tags --terse" local shortopts="-b -d -e -h -n -p -q -r -s -t" local cmds="invalid" - COMPREPLY=( $( compgen -W "${cmds} ${longopts} ${shortopts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${cmds} ${longopts} ${shortopts}" -- "${cur}" )" ) case "${prev}" in --filter) - COMPREPLY=( $( compgen -W "$(_avail_buildspec_filterfields)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_buildspec_filterfields)" -- "${cur}" )" ) ;; --format) - COMPREPLY=( $( compgen -W "$(_avail_buildspec_formatfields)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_buildspec_formatfields)" -- "${cur}" )" ) ;; esac ;; @@ -437,61 +437,61 @@ _buildtest () local longopts="--help --pager" local shortopts="-h" local allopts="${longopts} ${shortopts}" - COMPREPLY=( $( compgen -W "${allopts}" -- "${cur}" ) );; + COMPREPLY=( "$( compgen -W "${allopts}" -- "${cur}" )" );; esac ;; edit-file|ef) - COMPREPLY=( $( compgen -W "$(_avail_buildspecs)" -- "${cur}" ) );; + COMPREPLY=( "$( compgen -W "$(_avail_buildspecs)" -- "${cur}" )" );; edit-test|et) - COMPREPLY=( $( compgen -W "$(_buildspec_cache_test_names)" -- "${cur}" ) );; + COMPREPLY=( "$( compgen -W "$(_buildspec_cache_test_names)" -- "${cur}" )" );; show|s) local opts="-h --help --theme" - COMPREPLY=( $( compgen -W "$(_buildspec_cache_test_names)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_buildspec_cache_test_names)" -- "${cur}" )" ) if [[ $cur == -* ]] ; then - COMPREPLY=( $( compgen -W "$opts" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$opts" -- "${cur}" )" ) fi case "${prev}" in --theme) - COMPREPLY=( $( compgen -W "$(_avail_color_themes)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_color_themes)" -- "${cur}" )" ) return esac ;; show-fail|sf) local opts="-h --help --theme" - COMPREPLY=( $( compgen -W "$(_failed_tests)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_failed_tests)" -- "${cur}" )" ) if [[ $cur == -* ]] ; then - COMPREPLY=( $( compgen -W "$opts" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$opts" -- "${cur}" )" ) fi case "${prev}" in --theme) - COMPREPLY=( $( compgen -W "$(_avail_color_themes)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_color_themes)" -- "${cur}" )" ) return esac ;; maintainers|m) local opts="--breakdown --count --help --no-header --pager --row-count --terse -b -c -h -n find" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) case ${COMP_WORDS[3+offset]} in find) - COMPREPLY=( $( compgen -W "$(_avail_maintainers)" -- "${cur}" ) );; + COMPREPLY=( "$( compgen -W "$(_avail_maintainers)" -- "${cur}" )" );; esac ;; validate|val) local opts="--buildspec --exclude --executor --name --tag -b -e -n -t -x " - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) case "${prev}" in -b|--buildspec|-x|--exclude) - COMPREPLY=( $( compgen -W "$(_avail_buildspecs)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_buildspecs)" -- "${cur}" )" ) ;; -t|--tags) - COMPREPLY=( $( compgen -W "$(_avail_tags)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_tags)" -- "${cur}" )" ) ;; -e|--executor) - COMPREPLY=( $( compgen -W "$(_avail_executors)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_avail_executors)" -- "${cur}" )" ) ;; -n|--name) - COMPREPLY=( $( compgen -W "$(_buildspec_test_names)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_buildspec_test_names)" -- "${cur}" )" ) ;; esac ;; @@ -500,21 +500,21 @@ _buildtest () history|hy) local opts="--help -h" local cmds="list query" - COMPREPLY=( $( compgen -W "${cmds}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${cmds}" -- "${cur}" )" ) if [[ $cur == -* ]] ; then - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) fi case ${COMP_WORDS[2+offset]} in list) local opts="--help --no-header --pager --row-count --terse -h -n -t" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) ;; query) local opts="--help --log --output -h -l -o" - COMPREPLY=( $( compgen -W "$(_history_id)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_history_id)" -- "${cur}" )" ) if [[ $cur == -* ]]; then - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) fi ;; esac @@ -523,69 +523,69 @@ _buildtest () local cmds="upload view" local opts="--help -h" - COMPREPLY=( $( compgen -W "${cmds}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${cmds}" -- "${cur}" )" ) if [[ $cur == -* ]] ; then - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) fi case "${prev}" in view) local opts="-h --help" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) ;; upload) local opts="--help --open --site -h -o" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) ;; esac ;; stylecheck|style) local opts="--help --no-black --no-isort --no-pyflakes --apply -a -h" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) ;; unittests|test) local opts="--coverage --help --pytestopts --sourcefiles -c -h -p -s" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) ;; show|s) - COMPREPLY=( $( compgen -W "$(_buildtest_show_commands)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_buildtest_show_commands)" -- "${cur}" )" ) ;; commands|cmds) local opts="--help --with-aliases -a -h" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) ;; tutorial-examples) local cmds="aws spack" local opts="--help -h -d --dryrun --failfast -w --write" - COMPREPLY=( $( compgen -W "${cmds}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${cmds}" -- "${cur}" )" ) if [[ $cur == -* ]] ; then - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) fi ;; # options with only --help debugreport|info|docs) local opts="-h --help" - COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "${opts}" -- "${cur}" )" ) ;; *) case "${cur}" in # print main options to buildtest -*) - COMPREPLY=( $( compgen -W "$(_buildtest_options)" -- "${cur}" ) );; + COMPREPLY=( "$( compgen -W "$(_buildtest_options)" -- "${cur}" )" );; # print main sub-commands to buildtest *) - COMPREPLY=( $( compgen -W "$(_buildtest_commands)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_buildtest_commands)" -- "${cur}" )" ) case "${prev}" in --color) - COMPREPLY=( $( compgen -W "$(_supported_colors)" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "$(_supported_colors)" -- "${cur}" )" ) ;; --loglevel|-l) - COMPREPLY=( $( compgen -W "DEBUG INFO WARNING ERROR CRITICAL" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "DEBUG INFO WARNING ERROR CRITICAL" -- "${cur}" )" ) ;; --editor) - COMPREPLY=( $( compgen -W "vi vim emacs nano" -- "${cur}" ) ) + COMPREPLY=( "$( compgen -W "vi vim emacs nano" -- "${cur}" )" ) ;; esac ;;