Skip to main content
function RunCommand.bool_flag
def RunCommand.bool_flag(
name: str,
/,
*,
command: str,
version: None | str = None
) -> None | bool
The tri-state of boolean --name for command: True for --name / --name=true, False for --noname / --name=false, None if unset. The caller owns the default when None (e.g. --enable_bzlmod defaults on for Bazel 7+). function RunCommand.expand
def RunCommand.expand(
*,
command: str
) -> list
Expand all --config= flags for command into the fully-resolved flag list, compatible with ctx.bazel.build(flags=...). Version-gated options are filtered to the run command’s resolved Bazel version (same as flag_value / resolve_for_command), so the result reflects what Bazel actually receives — an option gated to a different version is dropped rather than reported as active. function RunCommand.expand_all
def RunCommand.expand_all(
*,
command: str
) -> (list, list)
Expand --config= flags for command, split into (startup_flags, flags) where common-section options are rendered as --default_override=0:common=... startup-side entries. Like expand, the command flags are filtered to the resolved Bazel version so version-gated options report accurately. function RunCommand.flag_value
def RunCommand.flag_value(
name: str,
/,
*,
command: str,
version: None | str = None
) -> None | str
The effective value of --name for command, or None if unset. Last-write-wins over the config-expanded options; matches --name=VALUE and the two-token --name VALUE form. version overrides the Bazel version used for version-gated options. function RunCommand.flag_values
def RunCommand.flag_values(
name: str,
/,
*,
command: str,
version: None | str = None
) -> list
All values of a repeatable --name option for command, in order — for flags that legitimately accumulate (--aspects, --output_groups, …). function RunCommand.merge
def RunCommand.merge(
other: bazel.RunCommand,
/
) -> bazel.RunCommand
Overlay other on top of this run command, returning a new one. other wins on conflicts (its options apply after this one’s under last-write-wins); startup flags, --config skip policy, and version are merged with other taking precedence when set. Neither input is mutated. function RunCommand.options_for
def RunCommand.options_for(
*,
command: str
) -> list
Options applicable to command without expanding --config=. Each item is a str or a (flag, version_condition) tuple. function RunCommand.sources
def RunCommand.sources() -> list
The source file paths that were loaded. function RunCommand.startup_flags
def RunCommand.startup_flags() -> list
The startup flags Bazel runs with under this run command: the user startup flags + the rc-file startup section + --ignore_all_rc_files.