From 11f2b612612748ee57728693c7745e3af92e9d54 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Sun, 5 Jan 2020 23:35:23 -0800 Subject: 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 --- .codecov.yml | 1 - 1 file changed, 1 deletion(-) (limited to '.codecov.yml') diff --git a/.codecov.yml b/.codecov.yml index e45c500b76..a70b19c39c 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -12,6 +12,5 @@ ignore: - lib/spack/docs/.* - lib/spack/external/.* - share/spack/qa/.* - - share/spack/spack-completion.bash comment: off -- cgit v1.2.3-60-g2f50