cleopter

2026-01-01

Minimalist command-line parser

Upstream URL

github.com/aadcg/cleopter

Author

André A. Gomes <andremegafone@gmail.com>

License

MIT
README
cleopter

A minimalist command-line parser written in portable Common Lisp.

cleopter lets you define command-line options using a simple, declarative syntax. That specification is then used to parse command-line arguments, and generate --help.

Tested on SBCL, CCL, ECL, ABCL, CLISP and Clasp.

Zero dependencies (even for the test suite).

1Example

See the example folder for a complete demonstration that builds a standalone executable with a fully-featured command-line interface.

The cleopter/example system (see cleopter.asd) specifies the path and entry point of the executable, which can be generated via make build-example.

Once built, try the invocations below:

./example/bin/example --help
./example/bin/example --foo     # Raises an error.
./example/bin/example -v        # Raises an error.
./example/bin/example -v "foo"  # Raises an error.
./example/bin/example -v 5
./example/bin/example --eval '(defvar foo 1)' \
                      --eval '(setf foo 2)' \
                      --eval '(format t "foo: ~a~%" foo)'

See example/example.lisp for implementation details.

2Acknowledgments

This work was partly funded by Bounce Commerce GmbH.

3References and related projects

https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap12.html

Dependencies (0)

    Dependents (0)

      • GitHub
      • Quicklisp