Standard Library

std.args

Command-line argument parsing utilities.

Exported functions

pub def all() -> List[String]

Return all command-line arguments as a list of strings.

pub def program() -> String

Return the program name (argv[0] with path stripped).

pub def parse[T](spec: T) -> CliParseResult

Parse command-line arguments using a declarative command spec.

pub def parse_with[T](spec: T, argv: List[String]) -> CliParseResult

Parse an explicit argv list using a declarative command spec.

pub def has(flag: String) -> Bool

Check if a flag is present in the arguments.

pub def get(option: String) -> String?

Get the value of an option argument.

pub def positional() -> List[String]

Return positional arguments (arguments that are not flags or option values).