Developer Tools

vcli

Parses command line arguments from a list, so the program stays testable.

Released v1.0.0 · 2026-09-28
Import
use "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.

vcli.ven
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
:: text

parse(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

Get notified when vcli changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.