nharmata | 1694de6 | 2018-11-12 09:22:23 -0800 | [diff] [blame] | 1 | # -*- sh -*- (Bash only) |
| 2 | # |
| 3 | # Copyright 2018 The Bazel Authors. All rights reserved. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # Bash completion of Bazel commands. |
| 18 | # |
| 19 | # Provides command-completion for: |
| 20 | # - bazel prefix options (e.g. --host_jvm_args) |
| 21 | # - blaze command-set (e.g. build, test) |
| 22 | # - blaze command-specific options (e.g. --copts) |
| 23 | # - values for enum-valued options |
| 24 | # - package-names, exploring all package-path roots. |
| 25 | # - targets within packages. |
| 26 | |
| 27 | # Environment variables for customizing behavior: |
| 28 | # |
| 29 | # BAZEL_COMPLETION_USE_QUERY - if "true", `bazel query` will be used for |
| 30 | # autocompletion; otherwise, a heuristic grep is used. This is more accurate |
| 31 | # than the heuristic grep, especially for strangely-formatted BUILD files. But |
| 32 | # it can be slower, especially if the Bazel server is busy, and more brittle, if |
| 33 | # the BUILD file contains serious errors. This is an experimental feature. |
| 34 | # |
| 35 | # BAZEL_COMPLETION_ALLOW_TESTS_FOR_RUN - if "true", autocompletion results for |
| 36 | # `bazel run` includes test targets. This is convenient for users who run a lot |
| 37 | # of tests/benchmarks locally with 'bazel run'. |
| 38 | |
| 39 | _bazel_completion_use_query() { |
| 40 | _bazel__is_true "${BAZEL_COMPLETION_USE_QUERY}" |
| 41 | } |
| 42 | |
| 43 | _bazel_completion_allow_tests_for_run() { |
| 44 | _bazel__is_true "${BAZEL_COMPLETION_ALLOW_TESTS_FOR_RUN}" |
| 45 | } |