Command-line argument parser with typed options, positional arguments, subcommands, and auto-generated help. Supports boolean negation, repeatable options, choice validation, and Levenshtein-based typo suggestions.
| Name | Signature |
|---|---|
format_help | format_help(cmd) -> help |
command | command(name, opts) -> cmd |
format_error | format_error(err) -> message |
format_help(
cmd) ->help
Generate markdown-formatted help text for a command
command(
name,opts) ->cmd
Create a new command parser with options, arguments, and subcommands
Returns a command object with chainable builder methods:
cmd:summary(text) — set one-line summary
cmd:description(text) — set longer description
cmd:option(name, spec) — add a named option
cmd:argument(name, spec) — add a positional argument
cmd:command(name, spec) — add a subcommand
cmd:build() — finalize configuration
cmd:parse(argv) — parse an argument list, returns (parsed, nil) or (nil, err)
The opts table accepts default_subcommand (string) and
subcommand_required (boolean, defaults to true).
format_error(
err) ->message
Format a parse error into a human-readable string