From 04a6a55cf8c0539ffe02f38162622a789fb8ad1f Mon Sep 17 00:00:00 2001
From: Todd Gamblin <tgamblin@llnl.gov>
Date: Thu, 23 Jan 2020 14:48:06 -0800
Subject: 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.
---
 share/spack/qa/update-completion-scripts.sh | 23 -----------------------
 share/spack/spack-completion.bash           |  2 +-
 2 files changed, 1 insertion(+), 24 deletions(-)
 delete mode 100755 share/spack/qa/update-completion-scripts.sh

(limited to 'share')

diff --git a/share/spack/qa/update-completion-scripts.sh b/share/spack/qa/update-completion-scripts.sh
deleted file mode 100755
index 8fcd321457..0000000000
--- a/share/spack/qa/update-completion-scripts.sh
+++ /dev/null
@@ -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
diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash
index 79dcf8e559..9550137bff 100755
--- a/share/spack/spack-completion.bash
+++ b/share/spack/spack-completion.bash
@@ -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
-- 
cgit v1.2.3-70-g09d2