diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2020-01-05 23:35:23 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2020-01-22 21:31:12 -0800 |
commit | 11f2b612612748ee57728693c7745e3af92e9d54 (patch) | |
tree | 656c2ba1de69064c62af1fbd4f43469f7c36cac9 /.coveragerc | |
parent | 8011fedd9ca47578e8da37a9060407c6784d7015 (diff) | |
download | spack-11f2b612612748ee57728693c7745e3af92e9d54.tar.gz spack-11f2b612612748ee57728693c7745e3af92e9d54.tar.bz2 spack-11f2b612612748ee57728693c7745e3af92e9d54.tar.xz spack-11f2b612612748ee57728693c7745e3af92e9d54.zip |
Use `spack commands --format=bash` to generate shell completion (#14393)
This PR adds a `--format=bash` option to `spack commands` to
auto-generate the Bash programmable tab completion script. It can be
extended to work for other shells.
Progress:
- [x] Fix bug in superclass initialization in `ArgparseWriter`
- [x] Refactor `ArgparseWriter` (see below)
- [x] Ensure that output of old `--format` options remains the same
- [x] Add `ArgparseCompletionWriter` and `BashCompletionWriter`
- [x] Add `--aliases` option to add command aliases
- [x] Standardize positional argument names
- [x] Tests for `spack commands --format=bash` coverage
- [x] Tests to make sure `spack-completion.bash` stays up-to-date
- [x] Tests for `spack-completion.bash` coverage
- [x] Speed up `spack-completion.bash` by caching subroutine calls
This PR also necessitates a significant refactoring of
`ArgparseWriter`. Previously, `ArgparseWriter` was mostly a single
`_write` method which handled everything from extracting the information
we care about from the parser to formatting the output. Now, `_write`
only handles recursion, while the information extraction is split into a
separate `parse` method, and the formatting is handled by `format`. This
allows subclasses to completely redefine how the format will appear
without overriding all of `_write`.
Co-Authored-by: Todd Gamblin <tgamblin@llnl.gov>
Diffstat (limited to '.coveragerc')
-rw-r--r-- | .coveragerc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/.coveragerc b/.coveragerc index c0c5f76688..7292badff5 100644 --- a/.coveragerc +++ b/.coveragerc @@ -9,6 +9,7 @@ omit = lib/spack/spack/test/* lib/spack/docs/* lib/spack/external/* + share/spack/qa/* [report] # Regexes for lines to exclude from consideration |