Skip to main content

cli_args

bool

def bool(
default = False,
doc: str = "",
*,
short = ...,
) -> bxl.CliArgs

Accepts "true" or "false" from cli, and get a bool in bxl. If not given, will get false


enum

def enum(
variants: list[str] | tuple[str, ...],
/,
default = ...,
doc: str = "",
*,
short = ...,
) -> bxl.CliArgs

Takes a set of defined values in variants, and gets a str in bxl.

e.g. cli.args.enumeration(["foo", "bar"]) defines an arg that only accepts "foo" or "bar".


float

def float(
default = ...,
doc: str = "",
*,
short = ...,
) -> bxl.CliArgs

Takes an arg from cli, and gets a float in bxl


int

def int(
default = ...,
doc: str = "",
*,
short = ...,
) -> bxl.CliArgs

Takes an arg from cli, and gets a int in bxl


json

def json(
doc: str = "",
*,
short = ...,
) -> bxl.CliArgs

Takes an arg from cli, and would be treated as a json string, and return a json object in bxl.

Note: It will not accept a json file path, if you want to pass a json file path, you can use like in cli --flag "$(cat foo.json)"


list

def list(
inner: bxl.CliArgs,
/,
default = ...,
doc: str = "",
*,
short = ...,
) -> bxl.CliArgs

Takes a list of args from cli, and gets a list of inner type in bxl.

e.g. cli.args.list(cli.args.string()) declares that the cli flag takes a list of args from cli, and gets a list of strings in bxl.


option

def option(
inner: bxl.CliArgs,
doc: str = "",
default = None,
*,
short = ...,
) -> bxl.CliArgs

Takes a arg from cli, and gets an inner type in bxl. If not given, will get None in bxl.

e.g. cli.args.option(cli.args.int()) defines an optional int arg.


string

def string(
default = ...,
doc: str = "",
*,
short = ...,
) -> bxl.CliArgs

Takes an arg from cli, and gets a string in bxl


sub_target

def sub_target(
doc: str = "",
*,
short = ...,
) -> bxl.CliArgs

Takes an arg from cli, and gets a parsed ProvidersLabel in bxl.

Note: this will not check if the target is valid.


sub_target_expr

def sub_target_expr(
doc: str = "",
*,
short = ...,
) -> bxl.CliArgs

Takes an arg from cli, and would be treated as a sub target pattern. We will get a list of ProvidersLabel in bxl.


target_expr

def target_expr(
doc: str = "",
*,
short = ...,
) -> bxl.CliArgs

Takes an arg from the cli, and treats it as a target pattern, e.g. "cell//foo:bar", "cell//foo:", or "cell//foo/...". We will get a list of TargetLabel in bxl.


target_label

def target_label(
doc: str = "",
*,
short = ...,
) -> bxl.CliArgs

Takes an arg from cli, and gets a parsed TargetLabel in bxl.

Note: this will not check if the target is valid.