Skip to content

Latest commit

 

History

History
67 lines (54 loc) · 1.43 KB

README.md

File metadata and controls

67 lines (54 loc) · 1.43 KB

Corne

Build Status

Commandline argument parser for Common Lisp

Usage

(in-package :cl-user)
(defpackage foo.bar
  (:use :cl :corne))
(in-package :foo.bar)

(defvar *cli*
  (cmd "hello"
       :help "corne example command"
       :version "1.0"
       :options (list (opt "verbose" :short "v" :long "verbose" :help ""))
       :arguments (list (arg "msg" :help "message"))))

(defun main (&rest argv)
  (let* ((res (parse *cli* argv)))
    (format t "hello ~A~%" (get-arg res "msg"))))

More examples are here.

Features

Auto help generation

$ ./example/hello.ros -h
hello 1.0
corne example command

USAGE: hello [OPTIONS] <MSG>

OPTIONS:
    -v, --verbose
    -h, --help       Prints help information

ARGUMENTS:
    <MSG>    message

Subcommand support

(defvar *cli*
  (cmd "subcommand"
       :help "corne example command"
       :version "1.0"
       :subcommands (list (cmd "foo" :help "foooo")
                          (cmd "bar" :help "baaar"
                                     :subcommands (list (cmd "baz" :help "baaaz"))))))

Installation

  • Corne is not registered Quicklisp yet.
  • clone to your local-projects
# ex
git clone https://github.com/liquidz/corne ~/.roswell/local-projects
  • register local project
(ql:register-local-projects)