summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2018-03-25 08:03:29 -0500
committerGitHub <noreply@github.com>2018-03-25 08:03:29 -0500
commit4332e75986ab1a5e272c2ea50bf313af3d6a0a83 (patch)
treef276c2058097eb3e39d57b5ffbfd3e729153127f /share
parentdffd8f384c1bc5e8cbb82db43e47d530c739dd66 (diff)
downloadspack-4332e75986ab1a5e272c2ea50bf313af3d6a0a83.tar.gz
spack-4332e75986ab1a5e272c2ea50bf313af3d6a0a83.tar.bz2
spack-4332e75986ab1a5e272c2ea50bf313af3d6a0a83.tar.xz
spack-4332e75986ab1a5e272c2ea50bf313af3d6a0a83.zip
Various updates to Spack's Bash completion (#7590)
* Various updates to Spack's Bash completion * Equals sign messes up tab completion
Diffstat (limited to 'share')
-rwxr-xr-xshare/spack/spack-completion.bash227
1 files changed, 175 insertions, 52 deletions
diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash
index 3da9d8de80..4bb00b33c6 100755
--- a/share/spack/spack-completion.bash
+++ b/share/spack/spack-completion.bash
@@ -114,9 +114,9 @@ function _bash_completion_spack {
function _spack {
if $list_options
then
- compgen -W "-h --help -d --debug -D --pdb -k --insecure -m --mock -p
- --profile -v --verbose -s --stacktrace -V --version
- --color --color=always --color=auto --color=never" -- "$cur"
+ 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"
else
compgen -W "$(_subcommands)" -- "$cur"
fi
@@ -125,7 +125,7 @@ function _spack {
function _spack_activate {
if $list_options
then
- compgen -W "-h --help -f --force" -- "$cur"
+ compgen -W "-h --help -f --force -v --view" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi
@@ -135,14 +135,20 @@ function _spack_arch {
compgen -W "-h --help -p --platform" -- "$cur"
}
-function _spack_bootstrap {
- # FIXME: What does this command even do?
+function _spack_blame {
if $list_options
then
- compgen -W "-h --help -r --remote" -- "$cur"
+ compgen -W "-h --help -t --time -p --percent -g --git" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
fi
}
+function _spack_bootstrap {
+ compgen -W "-h --help -j --jobs --keep-prefix --keep-stage -n --no-checksum
+ -v --verbose --clean --dirty --run-tests" -- "$cur"
+}
+
function _spack_build {
if $list_options
then
@@ -164,8 +170,8 @@ function _spack_buildcache {
function _spack_buildcache_create {
if $list_options
then
- compgen -W "-h --help -r --rel -f --force -y --yes-to-all -k --key
- -d --directory" -- "$cur"
+ compgen -W "-h --help -r --rel -f --force -u --unsigned -a --allow-root
+ -k --key -d --directory" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
@@ -174,23 +180,21 @@ function _spack_buildcache_create {
function _spack_buildcache_install {
if $list_options
then
- compgen -W "-h --help -f --force -y --yes-to-all" -- "$cur"
+ compgen -W "-h --help -f --force -m --multiple -a --allow-root -u
+ --unsigned" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
function _spack_buildcache_keys {
- if $list_options
- then
- compgen -W "-h --help -i --install -y --yes-to-all" -- "$cur"
- fi
+ compgen -W "-h --help -i --install -t --trust -f --force" -- "$cur"
}
function _spack_buildcache_list {
if $list_options
then
- compgen -W "-h --help" -- "$cur"
+ compgen -W "-h --help -f --force" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
@@ -220,12 +224,26 @@ function _spack_clean {
if $list_options
then
compgen -W "-h --help -s --stage -d --downloads
- -m --misc-cache -a --all" -- "$cur"
+ -m --misc-cache -a --all" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
}
+function _spack_clone {
+ if $list_options
+ then
+ compgen -W "-h --help -r --remote" -- "$cur"
+ fi
+}
+
+function _spack_commands {
+ if $list_options
+ then
+ compgen -W "-h --help --format" -- "$cur"
+ fi
+}
+
function _spack_compiler {
if $list_options
then
@@ -315,14 +333,17 @@ function _spack_configure {
}
function _spack_create {
- compgen -W "-h --help --keep-stage -n --name -t --template -r --repo
- -N --namespace -f --force" -- "$cur"
+ if $list_options
+ then
+ compgen -W "-h --help --keep-stage -n --name -t --template -r --repo
+ -N --namespace -f --force" -- "$cur"
+ fi
}
function _spack_deactivate {
if $list_options
then
- compgen -W "-h --help -f --force -a --all" -- "$cur"
+ compgen -W "-h --help -f --force -v --view -a --all" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi
@@ -341,10 +362,20 @@ function _spack_debug_create_db_tarball {
compgen -W "-h --help" -- "$cur"
}
+function _spack_dependencies {
+ if $list_options
+ then
+ compgen -W "-h --help -i --installed -t --transitive -V
+ --no-expand-virtuals" -- "$cur"
+ else
+ compgen -W "$(_all_packages)" -- "$cur"
+ fi
+}
+
function _spack_dependents {
if $list_options
then
- compgen -W "-h --help" -- "$cur"
+ compgen -W "-h --help -i --installed -t --transitive" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
@@ -360,16 +391,15 @@ function _spack_diy {
fi
}
-function _spack_doc {
- # FIXME: What does this command even do?
+function _spack_docs {
compgen -W "-h --help" -- "$cur"
}
function _spack_edit {
if $list_options
then
- compgen -W "-h --help -b --build-system -c --command -t --test -m --module
- -r --repo -N --namespace" -- "$cur"
+ compgen -W "-h --help -b --build-system -c --command -d --docs -t
+ --test -m --module -r --repo -N --namespace" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
@@ -378,7 +408,7 @@ function _spack_edit {
function _spack_env {
if $list_options
then
- compgen -W "-h --help" -- "$cur"
+ compgen -W "-h --help --clean --dirty" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
@@ -387,9 +417,11 @@ function _spack_env {
function _spack_extensions {
if $list_options
then
- compgen -W "-h --help -l --long -p --paths -d --deps" -- "$cur"
+ compgen -W "-h --help -l --long -p --paths -d --deps
+ -s --show -v --view" -- "$cur"
else
- compgen -W "go-bootstrap go lua octave python r ruby rust" -- "$cur"
+ compgen -W "aspell go-bootstrap go lua matlab octave perl python r ruby
+ rust tcl yorick" -- "$cur"
fi
}
@@ -406,10 +438,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 -f --show-flags --show-full-compiler
+ 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" -- "$cur"
+ -v --variants -M --only-missing -N --namespace --start-date
+ --end-date" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi
@@ -418,11 +451,74 @@ function _spack_find {
function _spack_flake8 {
if $list_options
then
- compgen -W "-h --help -k --keep-temp -o --output
+ compgen -W "-h --help -b --base -k --keep-temp -a --all -o --output
-r --root-relative -U --no-untracked" -- "$cur"
fi
}
+function _spack_gpg {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "create export init list sign trust untrust verify" -- "$cur"
+ fi
+}
+
+function _spack_gpg_create {
+ if $list_options
+ then
+ compgen -W "-h --help --comment --expires --export" -- "$cur"
+ fi
+}
+
+function _spack_gpg_export {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ fi
+}
+
+function _spack_gpg_init {
+ compgen -W "-h --help" -- "$cur"
+}
+
+function _spack_gpg_list {
+ compgen -W "-h --help --trusted --signing" -- "$cur"
+}
+
+function _spack_gpg_sign {
+ if $list_options
+ then
+ compgen -W "-h --help --output --key --clearsign" -- "$cur"
+ else
+ compgen -W "$(installed_packages)" -- "$cur"
+ fi
+}
+
+function _spack_gpg_trust {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ fi
+}
+
+function _spack_gpg_untrust {
+ if $list_options
+ then
+ compgen -W "-h --help --signing" -- "$cur"
+ fi
+}
+
+function _spack_gpg_verify {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ else
+ compgen -W "$(installed_packages)" -- "$cur"
+ fi
+}
+
function _spack_graph {
if $list_options
then
@@ -436,7 +532,7 @@ function _spack_graph {
function _spack_help {
if $list_options
then
- compgen -W "-h --help" -- "$cur"
+ compgen -W "-h --help -a --all --spec" -- "$cur"
else
compgen -W "$(_subcommands)" -- "$cur"
fi
@@ -457,8 +553,8 @@ function _spack_install {
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"
+ --clean --dirty --test --log-format --log-file
+ -y --yes-to-all" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
@@ -467,7 +563,8 @@ function _spack_install {
function _spack_list {
if $list_options
then
- compgen -W "-h --help -d --search-description --format" -- "$cur"
+ compgen -W "-h --help -d --search-description --format
+ -t --tags" -- "$cur"
else
compgen -W "$(_all_packages)" -- "$cur"
fi
@@ -493,10 +590,11 @@ function _spack_location {
fi
}
-function _spack_md5 {
+function _spack_log_parse {
if $list_options
then
- compgen -W "-h --help" -- "$cur"
+ compgen -W "-h --help --show -c --context -p --profile -w --width
+ -j --jobs" -- "$cur"
fi
}
@@ -539,6 +637,11 @@ function _spack_mirror_remove {
fi
}
+function _spack_mirror_rm {
+ # Alias to `spack mirror remove`
+ _spack_mirror_remove
+}
+
function _spack_module {
if $list_options
then
@@ -551,7 +654,7 @@ function _spack_module {
function _spack_module_find {
if $list_options
then
- compgen -W "-h --help -m --module-type" -- "$cur"
+ compgen -W "-h --help --full-path -m --module-type" -- "$cur"
else
compgen -W "$(_installed_packages)" -- "$cur"
fi
@@ -597,7 +700,6 @@ function _spack_patch {
}
function _spack_pkg {
- # FIXME: What does this subcommand even do?
if $list_options
then
compgen -W "-h --help" -- "$cur"
@@ -617,22 +719,34 @@ function _spack_pkg_add {
function _spack_pkg_added {
# FIXME: How to list git revisions?
- compgen -W "-h --help" -- "$cur"
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ fi
}
function _spack_pkg_diff {
# FIXME: How to list git revisions?
- compgen -W "-h --help" -- "$cur"
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ fi
}
function _spack_pkg_list {
# FIXME: How to list git revisions?
- compgen -W "-h --help" -- "$cur"
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ fi
}
function _spack_pkg_removed {
# FIXME: How to list git revisions?
- compgen -W "-h --help" -- "$cur"
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
+ fi
}
function _spack_providers {
@@ -640,8 +754,15 @@ function _spack_providers {
then
compgen -W "-h --help" -- "$cur"
else
- compgen -W "awk blas daal elf golang ipp lapack mkl
- mpe mpi opencl openfoam pil scalapack" -- "$cur"
+ compgen -W "awk blas D daal elf gl golang ipp java lapack mkl mpe mpi
+ opencl openfoam pil pkgconfig scalapack szip tbb" -- "$cur"
+ fi
+}
+
+function _spack_pydoc {
+ if $list_options
+ then
+ compgen -W "-h --help" -- "$cur"
fi
}
@@ -789,7 +910,10 @@ function _spack_url_list {
}
function _spack_url_parse {
- compgen -W "-h --help -s --spider" -- "$cur"
+ if $list_options
+ then
+ compgen -W "-h --help -s --spider" -- "$cur"
+ fi
}
function _spack_url_summary {
@@ -843,14 +967,14 @@ function _spack_view_hard {
function _spack_view_hardlink {
if $list_options
then
- compgen -W "-h --help" -- "$cur"
+ compgen -W "-h --help -i --ignore-conflicts" -- "$cur"
fi
}
function _spack_view_remove {
if $list_options
then
- compgen -W "-h --help" -- "$cur"
+ compgen -W "-h --help --no-remove-dependents -a --all" -- "$cur"
fi
}
@@ -879,14 +1003,14 @@ function _spack_view_status {
function _spack_view_symlink {
if $list_options
then
- compgen -W "-h --help" -- "$cur"
+ compgen -W "-h --help --ignore-conflicts" -- "$cur"
fi
}
# Helper functions for subcommands
function _subcommands {
- spack help --all | grep "^ [a-z]" | awk '{print $1}' | grep -v spack
+ spack commands
}
function _all_packages {
@@ -894,8 +1018,7 @@ function _all_packages {
}
function _installed_packages {
- # Perl one-liner used to strip out color codes
- spack find | grep -v "^--" | perl -pe 's/\e\[?.*?[\@-~]//g'
+ spack --color=never find | grep -v "^--"
}
function _installed_compilers {