Skip to content

aadcg/cleopter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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).

Example

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.

Acknowledgments

This work was partly funded by Bounce Commerce GmbH.

References and related projects

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

About

Minimalist command-line parser

Resources

License

Stars

Watchers

Forks

Packages

No packages published