Version0.18.1Verifiednot yet verifiedLicenseBSD-3-Clause

sigil-args

Command-line argument parsing for Sigil

Report a bug or suggest a feature
Readme

sigil-args

Declarative command-line argument parsing for Sigil.

Defines CLIs as composable record values: options, commands, subcommands, with automatic help generation.

Usage

(import (sigil args))

(define cli
  (command
    name: "greet"
    description: "Print a greeting"
    options: (list
              (option name: 'name short: #\n long: "name"
                      value: "NAME" default: "World")
              (option name: 'loud short: #\l long: "loud"
                      description: "Use uppercase"))
    handler: (lambda (opts args)
               (let ((greeting (format "Hello, ~a!" (alist-get 'name opts))))
                 (display (if (alist-get 'loud opts)
                              (string-upcase greeting)
                              greeting))
                 (newline)))))

(run-command cli (cdr (command-line)))

Supports short flags (-v, -vvv, -vf), long flags (--verbose, --no-verbose), values (-o val, --output=val), -- to stop option parsing, env-var fallback, choice restriction, multi-value (repeatable) options, negatable booleans, custom parsers, and required flags.

Commands that forward argv can declare passthrough: #t. Their handler takes (opts args passthrough): args contains operands before --, while passthrough contains the exact unparsed tail. It is #f when the separator is absent and () for an explicitly empty tail.

See `docs/args.md` for the full reference.

Building

sigil deps install
sigil build
sigil test

For local development against an in-tree sigil-lang checkout:

sigil build --redirects ./dev-redirects.sgl

License

BSD-3-Clause. See LICENSE (license header lives in package.sgl).

Clone

$ git clone https://codeberg.org/sigil/sigil-args

Releases

v0.18.1 — latest by version, released 30 Jul 2026

All releases — 6 tags in this repository.

Source

Browse the latest source

One page per file, and every line has a permalink.

Recent commitsAtom

The last 20 commits keep a page here. Everything older lives in the clone.