| --- |
| layout: documentation |
| title: Command-Line Reference |
| --- |
| |
| <div style="background-color: #EFCBCB; color: #AE2B2B; border: 1px solid #AE2B2B; border-radius: 5px; border-left: 10px solid #AE2B2B; padding: 0.5em;"> |
| <b>IMPORTANT:</b> The Bazel docs have moved! Please update your bookmark to <a href="https://bazel.build/reference/command-line-reference" style="color: #0000EE;">https://bazel.build/reference/command-line-reference</a> |
| <p/> |
| You can <a href="https://blog.bazel.build/2022/02/17/Launching-new-Bazel-site.html" style="color: #0000EE;">read about</a> the migration, and let us <a href="https://forms.gle/onkAkr2ZwBmcbWXj7" style="color: #0000EE;">know what you think</a>. |
| </div> |
| |
| <h1>Command-Line Reference</h1> |
| |
| <pre> |
| bazel [<startup options>] <command> [<args>] |
| </pre> |
| |
| or |
| |
| <pre> |
| bazel [<startup options>] <command> [<args>] -- [<target patterns>] |
| </pre> |
| |
| See the <a href="/docs/build#specifying-build-targets">User's Guide</a> for the |
| target patterns syntax. |
| |
| <h2>Option Syntax</h2> |
| |
| <p> |
| Options can be passed to Bazel in different ways. Options that require a value |
| can be passed with either an equals sign or a space: |
| <pre> |
| --<option>=<value> |
| --<option> <value> |
| </pre> |
| Some options have a single character short form; in that case, the short form |
| has to be passed with a single dash and a space. |
| <pre> |
| -<short_form> <value> |
| </pre> |
| </p> |
| |
| <p> |
| Boolean options can be enabled as follows: |
| <pre> |
| --<option> |
| --<option>=[true|yes|1] |
| </pre> |
| |
| and disabled as follows: |
| <pre> |
| --no<option> |
| --<option>=[false|no|0] |
| </pre> |
| </p> |
| |
| <p> |
| Tristate options are usually set to automatic by default, and can be |
| force-enabled as follows: |
| <pre> |
| --<option>=[true|yes|1] |
| </pre> |
| or force-disabled as follows: |
| <pre> |
| --no<option> |
| --<option>=[false|no|0] |
| </pre> |
| </p> |