Skip to main content

docs

This document provides an overview of the commands and options available under buck2 docs.

buck2 docs

Print documentation of specified symbols

Usage: buck2 docs <COMMAND>

Subcommands:

  • starlark: Print documentation of user-defined starlark symbols
  • starlark-builtins: Generate documentation for starlark builtins
  • uquery: Print documentation for query/uquery
  • cquery: Print documentation for cquery
  • aquery: Print documentation for aquery
  • markdown-help-doc: Print out the buck2 subcommand markdown docs

buck2 docs starlark

Print documentation of user-defined starlark symbols

Usage: buck2 docs starlark [OPTIONS] [SYMBOL_PATTERNS]...

Arguments:

  • <SYMBOL_PATTERNS> Patterns to interpret. //foo:bar.bzl is 'every symbol in //foo:bar.bzl', //foo:bar.bzl:baz only returns the documentation for the symbol 'baz' in //foo:bar.bzl

Options:

  • --output-dir <OUTPUT_DIR> Directory to write markdown files to. Required if format is markdown_files.

  • --format <FORMAT> how to format the returned documentation

    • Default value: json
    • Possible values:
      • json
      • markdown_files
  • -c, --config <SECTION.OPTION=VALUE> List of config options

  • --config-file <PATH> List of config file paths

  • --fake-host <HOST>

    • Possible values:
      • default
      • linux
      • macos
      • windows
  • --fake-arch <ARCH>

    • Possible values:
      • default
      • aarch64
      • x8664
  • --fake-xcode-version <VERSION-BUILD> Value must be formatted as: version-build (e.g., 14.3.0-14C18 or 14.1-14B47b)

  • --reuse-current-config Re-uses any --config values (inline or via modefiles) if there's a previous command, otherwise the flag is ignored.

    If there is a previous command and --reuse-current-config is set, then the old config is used, ignoring any overrides.

    If there is no previous command but the flag was set, then the flag is ignored, the command behaves as if the flag was not set at all.

  • --exit-when-different-state Used for exiting a concurrent command when a different state is detected

  • --preemptible <PREEMPTIBLE> Used to configure when this command could be preempted by another command for the same isolation dir.

    Normally, when you run two commands - from different terminals, say - buck2 will attempt to run them in parallel. However, if the two commands are based on different state, that is they either have different configs or different filesystem states, buck2 cannot run them in parallel. The default behavior in this case is to block the second command until the first completes.

    • Possible values:
      • never: (default) When another command starts that cannot run in parallel with this one, block that command
      • always: When another command starts, interrupt this command, even if they could run in parallel. There is no good reason to use this other than that it provides slightly nicer superconsole output
      • ondifferentstate: When another command starts that cannot run in parallel with this one, interrupt this command
  • --disable-starlark-types Disable runtime type checking in Starlark interpreter.

    This option is not stable, and can be used only locally to diagnose evaluation performance problems.

  • --stack Record or show target call stacks.

    Starlark call stacks will be included in duplicate targets error.

    If a command outputs targets (like targets command), starlark call stacks will be printed after the targets.

  • --console <super|simple|...> Which console to use for this command

    • Default value: auto
    • Possible values:
      • auto
      • none
      • simple
      • simplenotty
      • simpletty
      • super
  • --ui <UI> Configure additional superconsole ui components.

    Accepts a comma-separated list of superconsole components to add. Possible values are:

    dice - shows information about evaluated dice nodes debugevents - shows information about the flow of events from buckd

    These components can be turned on/off interactively. Press 'h' for help when superconsole is active.

    • Possible values:
      • dice
      • debugevents
      • io: I/O panel
      • re: RE panel
  • --no-interactive-console Disable console interactions

  • --event-log <PATH> Write events to this log file

  • --write-build-id <PATH> Write command invocation id into this file

  • --unstable-write-invocation-record <PATH> Write the invocation record (as JSON) to this path. No guarantees whatsoever are made regarding the stability of the format

  • --command-report-path <PATH> Write the command report to this path. A command report is always written to buck-out/v2/<uuid>/command_report even without this flag

buck2 docs starlark-builtins

Generate documentation for starlark builtins.

This command is designed to support buck2's doc generation and does not have stable output.

Usage: buck2 docs starlark-builtins [OPTIONS] --output-dir <OUTPUT_DIR>

Options:

  • --output-dir <OUTPUT_DIR> The directory to output files to

  • -c, --config <SECTION.OPTION=VALUE> List of config options

  • --config-file <PATH> List of config file paths

  • --fake-host <HOST>

    • Possible values:
      • default
      • linux
      • macos
      • windows
  • --fake-arch <ARCH>

    • Possible values:
      • default
      • aarch64
      • x8664
  • --fake-xcode-version <VERSION-BUILD> Value must be formatted as: version-build (e.g., 14.3.0-14C18 or 14.1-14B47b)

  • --reuse-current-config Re-uses any --config values (inline or via modefiles) if there's a previous command, otherwise the flag is ignored.

    If there is a previous command and --reuse-current-config is set, then the old config is used, ignoring any overrides.

    If there is no previous command but the flag was set, then the flag is ignored, the command behaves as if the flag was not set at all.

  • --exit-when-different-state Used for exiting a concurrent command when a different state is detected

  • --preemptible <PREEMPTIBLE> Used to configure when this command could be preempted by another command for the same isolation dir.

    Normally, when you run two commands - from different terminals, say - buck2 will attempt to run them in parallel. However, if the two commands are based on different state, that is they either have different configs or different filesystem states, buck2 cannot run them in parallel. The default behavior in this case is to block the second command until the first completes.

    • Possible values:
      • never: (default) When another command starts that cannot run in parallel with this one, block that command
      • always: When another command starts, interrupt this command, even if they could run in parallel. There is no good reason to use this other than that it provides slightly nicer superconsole output
      • ondifferentstate: When another command starts that cannot run in parallel with this one, interrupt this command
  • --disable-starlark-types Disable runtime type checking in Starlark interpreter.

    This option is not stable, and can be used only locally to diagnose evaluation performance problems.

  • --stack Record or show target call stacks.

    Starlark call stacks will be included in duplicate targets error.

    If a command outputs targets (like targets command), starlark call stacks will be printed after the targets.

  • --console <super|simple|...> Which console to use for this command

    • Default value: auto
    • Possible values:
      • auto
      • none
      • simple
      • simplenotty
      • simpletty
      • super
  • --ui <UI> Configure additional superconsole ui components.

    Accepts a comma-separated list of superconsole components to add. Possible values are:

    dice - shows information about evaluated dice nodes debugevents - shows information about the flow of events from buckd

    These components can be turned on/off interactively. Press 'h' for help when superconsole is active.

    • Possible values:
      • dice
      • debugevents
      • io: I/O panel
      • re: RE panel
  • --no-interactive-console Disable console interactions

  • --event-log <PATH> Write events to this log file

  • --write-build-id <PATH> Write command invocation id into this file

  • --unstable-write-invocation-record <PATH> Write the invocation record (as JSON) to this path. No guarantees whatsoever are made regarding the stability of the format

  • --command-report-path <PATH> Write the command report to this path. A command report is always written to buck-out/v2/<uuid>/command_report even without this flag

buck2 docs uquery

Print documentation for query/uquery

Usage: buck2 docs uquery [OPTIONS]

Options:

  • --format <FORMAT> How to format the documentation

    • Default value: rendered
    • Possible values:
      • markdown
      • rendered

buck2 docs cquery

Print documentation for cquery

Usage: buck2 docs cquery [OPTIONS]

Options:

  • --format <FORMAT> How to format the documentation

    • Default value: rendered
    • Possible values:
      • markdown
      • rendered

buck2 docs aquery

Print documentation for aquery

Usage: buck2 docs aquery [OPTIONS]

Options:

  • --format <FORMAT> How to format the documentation

    • Default value: rendered
    • Possible values:
      • markdown
      • rendered

buck2 docs markdown-help-doc

Print out the buck2 subcommand markdown docs

Usage: buck2 docs markdown-help-doc <SUB_COMMAND>

Arguments:

  • <SUB_COMMAND> The buck2 sub command we want to generate the markdown doc