Expand description
Command-line flag helpers for clap: the flag kinds the gadk deploy commands register
(string, int, duration and bool flags) as clap builder Args that parse like ADK’s CLI
flags, the value readers, passed (the flag was on the command line) and the mapping of
clap’s parse errors to ADK’s error texts (pflag_error).
Rules reproduced: --f=v and --f v, -f v, -fv and -f=v; a value-taking flag
takes the next argument even when it starts with -; a bool flag takes a value only as
--b=v, so --b v sets it true and leaves v as an argument; a
repeated flag keeps its last value; ints are parsed with the base chosen by the prefix
(0x, 0o, 0b, a leading 0 for octal, else decimal) into an i64, bools accept
1 t T TRUE true True 0 f F FALSE false False, and durations are signed sequences of
decimal numbers with unit suffixes (ns, us, ms, s, m, h) such as 2h45m; stray
positional arguments are accepted and ignored.
Constants§
- STRAY_
ARGS - The id of the hidden trailing positional that swallows stray arguments.
Functions§
- bool_
flag - A bool flag:
--bis true,--b=<v>takes a bool value (1 t T TRUE true True 0 f F FALSE false False); a value is never taken from the next argument. - bool_
value - A
bool_flag’s value. - duration_
flag - A duration flag: the value is a signed sequence of decimal numbers with unit suffixes
(
ns,us,ms,s,m,h);defaultis the text form of the default (e.g.1s,8760h0m0s). - duration_
value - A
duration_flag’s value. - int_
flag - An int flag: the value is an
i64with the base chosen by its prefix (0x,0o,0b, a leading0for octal, else decimal). - int_
value - An
int_flag’s value. - passed
- Whether the flag was on the command line.
- pflag_
command - A subcommand whose flags are POSIX-style: a repeated flag overrides the
earlier value instead of being a clap error, and there is no
helpsubcommand (only the root has one). - pflag_
error - ADK’s error text for clap’s parse error
eoncmd(the subcommand being parsed);raware the command-line arguments, used where clap does not keep what ADK’s text reports (the token an unknown shorthand came from, whether a value-less flag was written short). Errors with no ADK text keep clap’s message. - stray_
args - The hidden trailing positional: commands without a positional-argument validator accept and ignore positional arguments.
- string_
flag - A string flag.
- string_
value - A
string_flag’s value (its default when absent).