commands: add simple spack commands --update-completion argument (#14607)

Instead of another script, this adds a simple argument to `spack
commands` that updates the completion script.  Developers can now just
run:

    spack commands --update-completion

This should make it simpler for developers to remember to run this
*before* the tests fail.  Also, this version tab-completes.
This commit is contained in:
Todd Gamblin
2020-01-23 14:48:06 -08:00
committed by GitHub
parent 031fdfd7ca
commit 04a6a55cf8
4 changed files with 96 additions and 27 deletions

View File

@@ -1,23 +0,0 @@
#!/usr/bin/env bash
#
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
# Updates Spack's shell tab completion scripts
# Switch to parent directory
QA_DIR="$(dirname "${BASH_SOURCE[0]}")"
cd "$QA_DIR/.."
# Update each shell
for shell in bash # zsh fish
do
header=$shell/spack-completion.in
script=spack-completion.$shell
rm -f $script
spack commands --aliases --format=$shell --header=$header --update=$script
chmod +x $script
done

View File

@@ -507,7 +507,7 @@ _spack_clone() {
_spack_commands() {
if $list_options
then
SPACK_COMPREPLY="-h --help -a --aliases --format --header --update"
SPACK_COMPREPLY="-h --help --update-completion -a --aliases --format --header --update"
else
SPACK_COMPREPLY=""
fi