Move reads of some env vars to functions.
Slight refactor to the Bash completion script where we move reads of environment variables (whose values we expect users to mutate) to functions expected to be defined in a header file, that is expected to be prepended to the main script file contents. This is a pure refactor with no consequences.
Also, while I'm here, clean up comments.
RELNOTES: None
PiperOrigin-RevId: 221103777
diff --git a/scripts/BUILD b/scripts/BUILD
index 31e8958..95133bc 100644
--- a/scripts/BUILD
+++ b/scripts/BUILD
@@ -1,17 +1,20 @@
# Scripts for IDE / Environment support for Bazel
package(default_visibility = ["//visibility:private"])
-# The master copy of the completion logic are bazel-complete-template.bash
-# and bazel-complete-header.bash.
-# This is where you should make edits.
+# The master copy of the completion logic lives in bazel-complete-header.bash
+# and bazel-complete-template.bash. You should make edits in those files.
genrule(
name = "bash_completion",
- srcs = ["bazel-complete-template.bash"],
+ srcs = [
+ "bazel-complete-header.bash",
+ "bazel-complete-template.bash",
+ ],
outs = ["bazel-complete.bash"],
cmd = " ".join([
"$(location :generate_bash_completion.sh)",
"--bazel=$(location //src:bazel)",
"--output=$@",
+ "--prepend=$(location bazel-complete-header.bash)",
"--prepend=$(location bazel-complete-template.bash)",
]),
output_to_bindir = 1,