Skip to content

NATIVE BINARIES, ARGPARSING

Command-line Interfaces

Ship one native binary that starts instantly and carries no runtime with it. Parse flags, read stdin, colorize output, and hand users a cross-platform executable they can download and run.

ZZ compiles ahead of time to machine code, so a CLI is a single file your users download and run — no interpreter, no runtime to install, no startup tax. The standard library covers the parts every tool needs: argument parsing, environment, files, subprocesses, colours, and raw terminal control.

  • A flag parser built in — strings, integers, booleans, positionals, and subcommands.
  • Generated `--help` text and shell completions derived from the flag declarations.
  • ANSI colours that survive a pipe, plus raw-mode control for interactive prompts.
  • Files, paths, CSV, JSON, and encodings in the standard library — no dependency tree to ship.
  • Precise exit codes and structured diagnostics, so scripts can branch on what failed.

Modules

std.argsstd.colorsstd.termstd.fsstd.path
backup.zzzz
Run
import std.args
import std.colors
import std.env

func main() {
    p := ArgsParser.new()
    p.str_flag("out", "out.txt")
    p.int_flag("jobs", 4)
    p.bool_flag("verbose")

    if p.parse(env.args()) {
        out := p.get_str("out")
        jobs := p.get_int("jobs")
        println("output {out}")
        println("jobs   {jobs}")
    } else {
        println(p.error() |> colors.red())
    }
}

Runs in the playground — no install required. Open it

All four domainsBack to use casesCase studiesDocs