vyrn

CLI apps

args() is the argument list. std/args reads flags and options from it, and std/cli builds the whole command from a record type.

Reading arguments

std/args takes a token list. cli() takes the real arguments; cliOf(list) takes a list you supply, which is how a test checks the parsing without a process.

flag asks whether a token is present. opt reads --name=value and --name value, and answers Option<String>. positionals returns what is left, and rest returns what follows --.

-v false --verbose true port 8080 positionals site, docs

std/cli

std/cli goes further. Declare a record whose fields are the options, and give each field a validated type with its own documentation line. cli("./module") reflects it into a parser and a help text, so no flag name is written twice.

A parse answers Valid or Invalid with the issues attached to their fields, so a program reports every problem at once instead of the first one.