Developer Tools
vcli
Parses command line arguments from a list, so the program stays testable.
Released v1.0.0 · 2026-09-28use "stdlib/cli.ven"
Parses command line arguments from a list. Declare a parser, add named arguments with a kind and a help line, and read them back, so the program stays testable.
p = parser("mytool", "does a thing")
add_argument(p, "--name", "text", yes, "the name to greet")
print find_spec(p, "--name").kind
:: text
Reference (5 functions)
API reference
parser(program_name, description)
Builds a new, empty ArgParser.
parser("mytool", "does a thing")
ArgParser(program_name: "mytool", description: "does a thing", specs: [])add_argument(p, name, kind, required, help_text)
Declares one argument on p, in place.
p = parser("mytool", "does a thing")
add_argument(p, "--verbose", "flag", no, "print extra output")
p.specs
:: [ArgSpec(name: "--verbose", kind: "flag", required: no, help_text: "print extra output")]find_spec(p, name)
Gives back the ArgSpec declared on p under name, if any.
p = parser("mytool", "does a thing")
add_argument(p, "--name", "text", yes, "the name to greet")
find_spec(p, "--name").kind
:: textparse(p, args)
Parses args against ps declared arguments into a Map of values.
p = parser("mytool", "does a thing")
add_argument(p, "--name", "text", yes, "the name to greet")
add_argument(p, "--verbose", "flag", no, "print extra output")
parse(p, ["--name", "Ada", "--verbose"])
:: {"name": "Ada", "verbose": yes}help_text(p)
Renders a plain-text usage summary for p.
p = parser("mytool", "does a thing")
add_argument(p, "--name", "text", yes, "the name to greet")
add_argument(p, "--verbose", "flag", no, "print extra output")
help_text(p)
:: mytool -- does a thing
--name [text] (required): the name to greet
--verbose [flag]: print extra output