Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/liquidz/corne

Commandline argument parser for Common Lisp
https://github.com/liquidz/corne

argument-parsing command-line-parser common-lisp subcommands

Last synced: 2 days ago
JSON representation

Commandline argument parser for Common Lisp

Awesome Lists containing this project

README

        

# Corne
[![Build Status](https://travis-ci.org/liquidz/corne.svg?branch=master)](https://travis-ci.org/liquidz/corne)

Commandline argument parser for Common Lisp

## Usage

```lisp
(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](example).

## Features

### Auto help generation
```sh
$ ./example/hello.ros -h
hello 1.0
corne example command

USAGE: hello [OPTIONS]

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

ARGUMENTS:
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](https://www.quicklisp.org/beta/) yet.
* clone to your local-projects
```sh
# ex
git clone https://github.com/liquidz/corne ~/.roswell/local-projects
```
* register local project
```lisp
(ql:register-local-projects)
```