Parses the process's arguments. --help and --version print and exit 0; a bad command
line prints the error with a usage hint to stderr and exits 2.
Args :: #import "Extensions/Args";
Cli :: struct { name: string = "world"; @short=n }
HELP :: Args.Help(Cli).{ about = "Greets.", name = "Who to greet" };
cli, set := Args.parse(Cli, HELP);
print("hello, %\n", cli.name);This one is only checked to compile, not run.
- $T: the struct whose fields are the options.
- $help: the help strings for
T.
parse :: ($T: Type, $help: Help(T)) -> (T, Is_Set(T))
Parses the process's arguments. --help and --version print and exit 0; a bad command
line prints the error with a usage hint to stderr and exits 2.
Parameters
- $T: Type
- the struct whose fields are the options.
- $help: Help(T)
- the help strings for
T.
Returns
- T
- Is_Set(T)
Args :: #import "Extensions/Args";
Cli :: struct { name: string = "world"; @short=n }
HELP :: Args.Help(Cli).{ about = "Greets.", name = "Who to greet" };
cli, set := Args.parse(Cli, HELP);
print("hello, %\n", cli.name);This one is only checked to compile, not run.