optparser
optparser is a Unix command-line options parser for simple shell scripts, geared towards ease-of-use and unambiguity.

Inspired by python optparse module.

Example usage (SBCL)

#!/usr/bin/sbcl --script
(load "/path/to/asdf-init.lisp")
(asdf:operate 'asdf:load-op 'optparser)

(optparser:argv-let
  (argz
    (concurrency ("c" "concurrency" :value t))
    (verbose("v" "verbose")))
  *posix-argv*
  (format t
    "Arguments: ~s~%Optional values:~% verbose: ~s~% concurrency: ~s~%"
    argz verbose concurrency))


~% ./optparser-test.cl somepath1 --verbose somepath2 --concurrency 30
Arguments: ("/usr/bin/sbcl" "somepath1" "somepath2")
Optional values:
 verbose: T
 concurrency: "30"

~% ./optparser-test.cl -vc 10 somepath
Arguments: ("/usr/bin/sbcl" "somepath")
Optional values:
 verbose: T
 concurrency: "10"

Note that *posix-argv* var is SBCL-specific

Links

Home page

ASDF-install package (obsolete) http://fraggod.net/oss/projects/optparser-1.1.tar.gz


system programming