From 29f26da04df286ad9d40ef60557e5cd163ea49e1 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Mon, 17 Dec 2018 13:02:09 -0600 Subject: Update Spack's Bash completion script (#10114) * Update Spack's Bash completion script * spack mirror create options changed --- share/spack/spack-completion.bash | 206 +++++++++++++++++++++++++++++++------- 1 file changed, 171 insertions(+), 35 deletions(-) diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index c157d836a4..288746863c 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -95,9 +95,12 @@ function _bash_completion_spack { function _spack { if $list_options then - compgen -W "-h --help --color -d --debug -D --pdb -k --insecure - -m --mock -p --profile -P --sorted-profile --lines - -v --verbose -s --stacktrace -V --version" -- "$cur" + compgen -W "-h --help -H --all-help --color -C --config-scope + -d --debug --pdb -e --env -D --env-dir -E --no-env + --use-env-repo -k --insecure -l --enable-locks + -L --disable-locks -m --mock -p --profile + --sorted-profile --lines -v --verbose --stacktrace + -V --version --print-shell-vars" -- "$cur" else compgen -W "$(_subcommands)" -- "$cur" fi @@ -112,6 +115,15 @@ function _spack_activate { fi } +function _spack_add { + if $list_options + then + compgen -W "-h --help" -- "$cur" + else + compgen -W "$(_all_packages)" -- "$cur" + fi +} + function _spack_arch { compgen -W "-h --help -p --platform -o --operating-system -t --target" -- "$cur" @@ -127,8 +139,8 @@ function _spack_blame { } function _spack_bootstrap { - compgen -W "-h --help -j --jobs --keep-prefix --keep-stage -n --no-checksum - -v --verbose --clean --dirty --run-tests" -- "$cur" + compgen -W "-h --help -j --jobs --keep-prefix --keep-stage + -n --no-checksum -v --verbose --clean --dirty" -- "$cur" } function _spack_build { @@ -140,6 +152,15 @@ function _spack_build { fi } +function _spack_build_env { + if $list_options + then + compgen -W "-h --help --clean --dirty" -- "$cur" + else + compgen -W "$(_all_packages)" -- "$cur" + fi +} + function _spack_buildcache { if $list_options then @@ -187,7 +208,7 @@ function _spack_cd { then compgen -W "-h --help -m --module-dir -r --spack-root -i --install-dir -p --package-dir -P --packages -s --stage-dir -S --stages - -b --build-dir" -- "$cur" + -b --build-dir -e --env" -- "$cur" else compgen -W "$(_all_packages)" -- "$cur" fi @@ -206,7 +227,7 @@ function _spack_clean { if $list_options then compgen -W "-h --help -s --stage -d --downloads - -m --misc-cache -a --all" -- "$cur" + -m --misc-cache -p --python-cache -a --all" -- "$cur" else compgen -W "$(_all_packages)" -- "$cur" fi @@ -278,16 +299,20 @@ function _spack_compilers { compgen -W "-h --help --scope" -- "$cur" } +function _spack_concretize { + compgen -W "-h --help -f --force" -- "$cur" +} + function _spack_config { if $list_options then compgen -W "-h --help --scope" -- "$cur" else - compgen -W "edit get" -- "$cur" + compgen -W "blame edit get" -- "$cur" fi } -function _spack_config_edit { +function _spack_config_blame { if $list_options then compgen -W "-h --help" -- "$cur" @@ -296,6 +321,15 @@ function _spack_config_edit { fi } +function _spack_config_edit { + if $list_options + then + compgen -W "-h --help --print-file" -- "$cur" + else + compgen -W "mirrors repos modules packages config compilers" -- "$cur" + fi +} + function _spack_config_get { if $list_options then @@ -366,8 +400,10 @@ function _spack_dependents { function _spack_diy { if $list_options then - compgen -W "-h --help -i --ignore-dependencies --keep-prefix - --skip-patch -q --quiet --clean --dirty" -- "$cur" + compgen -W "-h --help -j --jobs -d --source-path + -i --ignore-dependencies -n --no-checksum + --keep-prefix --skip-patch -q --quiet --clean + --dirty" -- "$cur" else compgen -W "$(_all_packages)" -- "$cur" fi @@ -390,19 +426,83 @@ function _spack_edit { function _spack_env { if $list_options then - compgen -W "-h --help --clean --dirty" -- "$cur" + compgen -W "-h --help" -- "$cur" else - compgen -W "$(_all_packages)" -- "$cur" + compgen -W "activate create deactivate list ls loads + remove rm status st" -- "$cur" + fi +} + +function _spack_env_activate { + if $list_options + then + compgen -W "-h --help --sh --csh -d --dir -p --prompt" -- "$cur" + else + compgen -W "$(_environments)" -- "$cur" fi } +function _spack_env_create { + if $list_options + then + compgen -W "-h --help -d --dir" -- "$cur" + fi +} + +function _spack_env_deactivate { + compgen -W "-h --help --sh --csh" -- "$cur" +} + +function _spack_env_list { + compgen -W "-h --help" -- "$cur" +} + +function _spack_env_ls { + # Alias to `spack env list` + _spack_env_list +} + +function _spack_env_loads { + if $list_options + then + compgen -W "-h --help -m --module-type --input-only -p --prefix + -x --exclude -r --dependencies" -- "$cur" + else + compgen -W "$(_environments)" -- "$cur" + fi +} + +function _spack_env_remove { + if $list_options + then + compgen -W "-h --help -y --yes-to-all" -- "$cur" + else + compgen -W "$(_environments)" -- "$cur" + fi +} + +function _spack_env_rm { + # Alias to `spack env remove` + _spack_env_remove +} + +function _spack_env_status { + compgen -W "-h --help" -- "$cur" +} + +function _spack_env_st { + # Alias to `spack env status` + _spack_env_status +} + function _spack_extensions { if $list_options then compgen -W "-h --help -l --long -p --paths -d --deps -s --show -v --view" -- "$cur" else - compgen -W "aspell go-bootstrap go lua matlab octave perl python r ruby + compgen -W "aspell go-bootstrap go icedtea java jdk lua + matlab mofem-cephas octave perl python r ruby rust tcl yorick" -- "$cur" fi } @@ -420,10 +520,11 @@ function _spack_fetch { function _spack_find { if $list_options then - compgen -W "-h --help -s --short -p --paths -d --deps -l --long -L - --very-long -t --tags -f --show-flags --show-full-compiler - -e --explicit -E --implicit -u --unknown -m --missing - -v --variants -M --only-missing -N --namespace --start-date + compgen -W "-h --help -s --short -p --paths -d --deps -l --long + -L --very-long -t --tags -c --show-concretized + -f --show-flags --show-full-compiler -x --explicit + -X --implicit -u --unknown -m --missing -v --variants + -M --only-missing -N --namespace --start-date --end-date" -- "$cur" else compgen -W "$(_installed_packages)" -- "$cur" @@ -532,16 +633,34 @@ function _spack_info { function _spack_install { if $list_options then - compgen -W "-h --help --only -j --jobs --overwrite --keep-prefix - --keep-stage --dont-restage --use-cache --show-log-on-error - --source -n --no-checksum -v --verbose --fake -f --file - --clean --dirty --test --log-format --log-file - -y --yes-to-all" -- "$cur" + compgen -W "-h --help --only -j --jobs -I --install-status + --overwrite --keep-prefix --keep-stage --dont-restage + --use-cache --no-cache --show-log-on-error --source + -n --no-checksum -v --verbose --fake --only-concrete + -f --file --clean --dirty --test --log-format --log-file + --cdash-upload-url -y --yes-to-all" -- "$cur" else compgen -W "$(_all_packages)" -- "$cur" fi } +function _spack_license { + if $list_options + then + compgen -W "-h --help" -- "$cur" + else + compgen -W "list-files verify" -- "$cur" + fi +} + +function _spack_license_list_files { + compgen -W "-h --help" -- "$cur" +} + +function _spack_license_verify { + compgen -W "-h --help --root" -- "$cur" +} + function _spack_list { if $list_options then @@ -555,7 +674,7 @@ function _spack_list { function _spack_load { if $list_options then - compgen -W "-h --help" -- "$cur" + compgen -W "-h --help -r --dependencies" -- "$cur" else compgen -W "$(_installed_packages)" -- "$cur" fi @@ -566,7 +685,7 @@ function _spack_location { then compgen -W "-h --help -m --module-dir -r --spack-root -i --install-dir -p --package-dir -P --packages -s --stage-dir -S --stages - -b --build-dir" -- "$cur" + -b --build-dir -e --env" -- "$cur" else compgen -W "$(_all_packages)" -- "$cur" fi @@ -600,7 +719,7 @@ function _spack_mirror_create { if $list_options then compgen -W "-h --help -d --directory -f --file - -D --dependencies -o --one-version-per-spec" -- "$cur" + -D --dependencies -n --versions-per-spec" -- "$cur" else compgen -W "$(_all_packages)" -- "$cur" fi @@ -872,6 +991,15 @@ function _spack_reindex { compgen -W "-h --help" -- "$cur" } +function _spack_remove { + if $list_options + then + compgen -W "-h --help -a --all -f --force" -- "$cur" + else + compgen -W "$(_all_packages)" -- "$cur" + fi +} + function _spack_repo { if $list_options then @@ -925,8 +1053,8 @@ function _spack_restage { function _spack_setup { if $list_options then - compgen -W "-h --help -i --ignore-dependencies -v --verbose - --clean --dirty" -- "$cur" + compgen -W "-h --help -i --ignore-dependencies -n --no-checksum + -v --verbose --clean --dirty" -- "$cur" else compgen -W "$(_all_packages)" -- "$cur" fi @@ -935,8 +1063,8 @@ function _spack_setup { function _spack_spec { if $list_options then - compgen -W "-h --help -l --long -L --very-long -y --yaml -c --cover - -N --namespaces -I --install-status -t --types" -- "$cur" + compgen -W "-h --help -l --long -L --very-long -I --install-status + -y --yaml -c --cover -N --namespaces -t --types" -- "$cur" else compgen -W "$(_all_packages)" -- "$cur" fi @@ -964,8 +1092,8 @@ function _spack_test { function _spack_uninstall { if $list_options then - compgen -W "-h --help -f --force -a --all -R --dependents - -y --yes-to-all" -- "$cur" + compgen -W "-h --help -f --force -R --dependents + -y --yes-to-all -a --all" -- "$cur" else compgen -W "$(_installed_packages)" -- "$cur" fi @@ -994,7 +1122,7 @@ function _spack_url { then compgen -W "-h --help" -- "$cur" else - compgen -W "list parse summary" -- "$cur" + compgen -W "list parse stats summary" -- "$cur" fi } @@ -1011,6 +1139,10 @@ function _spack_url_parse { fi } +function _spack_url_stats { + compgen -W "-h --help" -- "$cur" +} + function _spack_url_summary { compgen -W "-h --help" -- "$cur" } @@ -1018,7 +1150,7 @@ function _spack_url_summary { function _spack_use { if $list_options then - compgen -W "-h --help" -- "$cur" + compgen -W "-h --help -r --dependencies" -- "$cur" else compgen -W "$(_installed_packages)" -- "$cur" fi @@ -1098,7 +1230,7 @@ function _spack_view_status { function _spack_view_symlink { if $list_options then - compgen -W "-h --help --ignore-conflicts" -- "$cur" + compgen -W "-h --help -i --ignore-conflicts" -- "$cur" fi } @@ -1136,6 +1268,10 @@ function _tests { spack test -l } +function _environments { + spack env list +} + # Testing functions function _test_vars { -- cgit v1.2.3-70-g09d2