The cl-cli Reference Manual

This is the cl-cli Reference Manual, version 0.2, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed May 15 03:49:06 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 cl-cli

Command line parser

Maintainer

Sébastien Gross

Author

Sébastien Gross

License

WTFPL

Long Description

Simple and easy to use modern command line argument parser for common lisp.

Version

0.2

Dependency

split-sequence (system).

Source

cl-cli.asd.

Child Component

cl-cli.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 cl-cli/cl-cli.asd

Source

cl-cli.asd.

Parent Component

cl-cli (system).

ASDF Systems

cl-cli.


3.1.2 cl-cli/cl-cli.lisp

Source

cl-cli.asd.

Parent Component

cl-cli (system).

Packages

cl-cli.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 cl-cli

Source

cl-cli.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Macros

Macro: defcommand (verbs options docstring &body body)

Create a new command defined by VERBS list (dispatch arguments) a list of OPTIONS, a DOCSTRING and use BODY as dispatch function.

Package

cl-cli.

Source

cl-cli.lisp.

Macro: defcommand-to-list (var verbs options docstring &body body)

Call DEFCOMMAND and append result to VAR.

Package

cl-cli.

Source

cl-cli.lisp.

Macro: with-environment (vars vals &body body)
Package

cl-cli.

Source

cl-cli.lisp.


5.1.2 Ordinary functions

Function: help (options sub-commands &key prog-name version prolog epilog)
Package

cl-cli.

Source

cl-cli.lisp.

Function: parse-cli (argv &optional options commands)

Parse ARGV using OPTIONS both and COMMANDS directives.

Return:
- options variables
- options values
- matched command dispatch function
- dispatch function keyword arguments
- the rest of the command line argument

Package

cl-cli.

Source

cl-cli.lisp.

Function: run-command (argv &optional options commands)

Parse ARGV using OPTIONS both and COMMANDS directives.

Package

cl-cli.

Source

cl-cli.lisp.

Function: version (prog-name version &key copyright quit)
Package

cl-cli.

Source

cl-cli.lisp.


5.2 Internals


5.2.1 Ordinary functions

Function: %make-options-list (options)

Convert given OPTIONS list into a list of CL-CLI:OPTION

Package

cl-cli.

Source

cl-cli.lisp.

Function: %print-option (option)
Package

cl-cli.

Source

cl-cli.lisp.

Function: %print-positional (option)
Package

cl-cli.

Source

cl-cli.lisp.

Function: %symbol-to-option-string (symbol)

Convert SYMBOL to its argument string representation by prepending with double dash "–" and removing fancy chars such as "*".

Package

cl-cli.

Source

cl-cli.lisp.

Function: consume-option (args option)

Extract all OPTION arguments from ARGS.
Return both consumed arguments count and the arguments

Package

cl-cli.

Source

cl-cli.lisp.

Function: convert-vars-vals-to-keys (vars vals)

Convert VARS and VALS lists to a keyword plist.

Example:
’(VAR1 VAR1) (val1 val2) => (:VAR1 val1 :VAR2 val2)

Package

cl-cli.

Source

cl-cli.lisp.

Function: copy-option (instance)
Package

cl-cli.

Source

cl-cli.lisp.

Function: copy-sub-command (instance)
Package

cl-cli.

Source

cl-cli.lisp.

Function: get-positional-args (argv cmd)
Package

cl-cli.

Source

cl-cli.lisp.

Function: make-option (name default help &key long alias params type)
Package

cl-cli.

Source

cl-cli.lisp.

Function: make-sub-command (verbs options positional docstring func)
Package

cl-cli.

Source

cl-cli.lisp.

Reader: opt-alias (instance)
Writer: (setf opt-alias) (instance)
Package

cl-cli.

Source

cl-cli.lisp.

Target Slot

alias.

Reader: opt-default (instance)
Writer: (setf opt-default) (instance)
Package

cl-cli.

Source

cl-cli.lisp.

Target Slot

default.

Reader: opt-help (instance)
Writer: (setf opt-help) (instance)
Package

cl-cli.

Source

cl-cli.lisp.

Target Slot

help.

Reader: opt-long (instance)
Writer: (setf opt-long) (instance)
Package

cl-cli.

Source

cl-cli.lisp.

Target Slot

long.

Reader: opt-name (instance)
Writer: (setf opt-name) (instance)
Package

cl-cli.

Source

cl-cli.lisp.

Target Slot

name.

Reader: opt-params (instance)
Writer: (setf opt-params) (instance)
Package

cl-cli.

Source

cl-cli.lisp.

Target Slot

params.

Reader: opt-type (instance)
Writer: (setf opt-type) (instance)
Package

cl-cli.

Source

cl-cli.lisp.

Target Slot

type.

Function: option-p (object)
Package

cl-cli.

Source

cl-cli.lisp.

Function: parse-command-args (args)

Parse ARGS and return 3 lists:

- A function suitable lambda-list
- A list of all positional arguments
- A list of all key arguments.

ARGS is a lambda-list as defined for defcommand.

Package

cl-cli.

Source

cl-cli.lisp.

Function: parse-commands (argv commands)
Package

cl-cli.

Source

cl-cli.lisp.

Function: parse-options (argv options)
Package

cl-cli.

Source

cl-cli.lisp.

Function: sub-command-p (object)
Package

cl-cli.

Source

cl-cli.lisp.

Reader: sub-docstring (instance)
Writer: (setf sub-docstring) (instance)
Package

cl-cli.

Source

cl-cli.lisp.

Target Slot

docstring.

Reader: sub-func (instance)
Writer: (setf sub-func) (instance)
Package

cl-cli.

Source

cl-cli.lisp.

Target Slot

func.

Reader: sub-options (instance)
Writer: (setf sub-options) (instance)
Package

cl-cli.

Source

cl-cli.lisp.

Target Slot

options.

Reader: sub-positional (instance)
Writer: (setf sub-positional) (instance)
Package

cl-cli.

Source

cl-cli.lisp.

Target Slot

positional.

Reader: sub-verbs (instance)
Writer: (setf sub-verbs) (instance)
Package

cl-cli.

Source

cl-cli.lisp.

Target Slot

verbs.


5.2.2 Generic functions

Generic Reader: bad-argument-type-option (condition)
Package

cl-cli.

Methods
Reader Method: bad-argument-type-option ((condition bad-argument-type))
Source

cl-cli.lisp.

Target Slot

option.

Generic Reader: bad-argument-type-type (condition)
Package

cl-cli.

Methods
Reader Method: bad-argument-type-type ((condition bad-argument-type))
Source

cl-cli.lisp.

Target Slot

type.

Generic Reader: not-enougth-pos-args-command (condition)
Package

cl-cli.

Methods
Reader Method: not-enougth-pos-args-command ((condition not-enougth-pos-args))
Source

cl-cli.lisp.

Target Slot

command.

Generic Reader: not-enougth-pos-args-count (condition)
Package

cl-cli.

Methods
Reader Method: not-enougth-pos-args-count ((condition not-enougth-pos-args))
Source

cl-cli.lisp.

Target Slot

count.

Generic Reader: not-enougth-pos-args-items (condition)
Package

cl-cli.

Methods
Reader Method: not-enougth-pos-args-items ((condition not-enougth-pos-args))
Source

cl-cli.lisp.

Target Slot

items.

Generic Reader: option-requires-argument-nargs (condition)
Package

cl-cli.

Methods
Reader Method: option-requires-argument-nargs ((condition option-requires-argument))
Source

cl-cli.lisp.

Target Slot

nargs.

Generic Reader: option-requires-argument-option (condition)
Package

cl-cli.

Methods
Reader Method: option-requires-argument-option ((condition option-requires-argument))
Source

cl-cli.lisp.

Target Slot

option.


5.2.3 Conditions

Condition: bad-argument-type
Package

cl-cli.

Source

cl-cli.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: option
Initargs

:option

Readers

bad-argument-type-option.

Writers

This slot is read-only.

Slot: type
Package

common-lisp.

Initargs

:type

Readers

bad-argument-type-type.

Writers

This slot is read-only.

Condition: not-enougth-pos-args
Package

cl-cli.

Source

cl-cli.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: command
Initargs

:command

Readers

not-enougth-pos-args-command.

Writers

This slot is read-only.

Slot: count
Package

common-lisp.

Initargs

:count

Readers

not-enougth-pos-args-count.

Writers

This slot is read-only.

Slot: items
Initargs

:items

Readers

not-enougth-pos-args-items.

Writers

This slot is read-only.

Condition: option-requires-argument
Package

cl-cli.

Source

cl-cli.lisp.

Direct superclasses

error.

Direct methods
Direct slots
Slot: option
Initargs

:option

Readers

option-requires-argument-option.

Writers

This slot is read-only.

Slot: nargs
Initargs

:nargs

Readers

option-requires-argument-nargs.

Writers

This slot is read-only.


5.2.4 Structures

Structure: option
Package

cl-cli.

Source

cl-cli.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: name
Readers

opt-name.

Writers

(setf opt-name).

Slot: default
Readers

opt-default.

Writers

(setf opt-default).

Slot: help
Readers

opt-help.

Writers

(setf opt-help).

Slot: long
Readers

opt-long.

Writers

(setf opt-long).

Slot: alias
Readers

opt-alias.

Writers

(setf opt-alias).

Slot: params
Readers

opt-params.

Writers

(setf opt-params).

Slot: type
Package

common-lisp.

Readers

opt-type.

Writers

(setf opt-type).

Structure: sub-command
Package

cl-cli.

Source

cl-cli.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: verbs
Readers

sub-verbs.

Writers

(setf sub-verbs).

Slot: options
Readers

sub-options.

Writers

(setf sub-options).

Slot: positional
Readers

sub-positional.

Writers

(setf sub-positional).

Slot: docstring
Readers

sub-docstring.

Writers

(setf sub-docstring).

Slot: func
Readers

sub-func.

Writers

(setf sub-func).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
B   C   D   F   G   H   M   N   O   P   R   S   V   W  
Index Entry  Section

%
%make-options-list: Private ordinary functions
%print-option: Private ordinary functions
%print-positional: Private ordinary functions
%symbol-to-option-string: Private ordinary functions

(
(setf opt-alias): Private ordinary functions
(setf opt-default): Private ordinary functions
(setf opt-help): Private ordinary functions
(setf opt-long): Private ordinary functions
(setf opt-name): Private ordinary functions
(setf opt-params): Private ordinary functions
(setf opt-type): Private ordinary functions
(setf sub-docstring): Private ordinary functions
(setf sub-func): Private ordinary functions
(setf sub-options): Private ordinary functions
(setf sub-positional): Private ordinary functions
(setf sub-verbs): Private ordinary functions

B
bad-argument-type-option: Private generic functions
bad-argument-type-option: Private generic functions
bad-argument-type-type: Private generic functions
bad-argument-type-type: Private generic functions

C
consume-option: Private ordinary functions
convert-vars-vals-to-keys: Private ordinary functions
copy-option: Private ordinary functions
copy-sub-command: Private ordinary functions

D
defcommand: Public macros
defcommand-to-list: Public macros

F
Function, %make-options-list: Private ordinary functions
Function, %print-option: Private ordinary functions
Function, %print-positional: Private ordinary functions
Function, %symbol-to-option-string: Private ordinary functions
Function, (setf opt-alias): Private ordinary functions
Function, (setf opt-default): Private ordinary functions
Function, (setf opt-help): Private ordinary functions
Function, (setf opt-long): Private ordinary functions
Function, (setf opt-name): Private ordinary functions
Function, (setf opt-params): Private ordinary functions
Function, (setf opt-type): Private ordinary functions
Function, (setf sub-docstring): Private ordinary functions
Function, (setf sub-func): Private ordinary functions
Function, (setf sub-options): Private ordinary functions
Function, (setf sub-positional): Private ordinary functions
Function, (setf sub-verbs): Private ordinary functions
Function, consume-option: Private ordinary functions
Function, convert-vars-vals-to-keys: Private ordinary functions
Function, copy-option: Private ordinary functions
Function, copy-sub-command: Private ordinary functions
Function, get-positional-args: Private ordinary functions
Function, help: Public ordinary functions
Function, make-option: Private ordinary functions
Function, make-sub-command: Private ordinary functions
Function, opt-alias: Private ordinary functions
Function, opt-default: Private ordinary functions
Function, opt-help: Private ordinary functions
Function, opt-long: Private ordinary functions
Function, opt-name: Private ordinary functions
Function, opt-params: Private ordinary functions
Function, opt-type: Private ordinary functions
Function, option-p: Private ordinary functions
Function, parse-cli: Public ordinary functions
Function, parse-command-args: Private ordinary functions
Function, parse-commands: Private ordinary functions
Function, parse-options: Private ordinary functions
Function, run-command: Public ordinary functions
Function, sub-command-p: Private ordinary functions
Function, sub-docstring: Private ordinary functions
Function, sub-func: Private ordinary functions
Function, sub-options: Private ordinary functions
Function, sub-positional: Private ordinary functions
Function, sub-verbs: Private ordinary functions
Function, version: Public ordinary functions

G
Generic Function, bad-argument-type-option: Private generic functions
Generic Function, bad-argument-type-type: Private generic functions
Generic Function, not-enougth-pos-args-command: Private generic functions
Generic Function, not-enougth-pos-args-count: Private generic functions
Generic Function, not-enougth-pos-args-items: Private generic functions
Generic Function, option-requires-argument-nargs: Private generic functions
Generic Function, option-requires-argument-option: Private generic functions
get-positional-args: Private ordinary functions

H
help: Public ordinary functions

M
Macro, defcommand: Public macros
Macro, defcommand-to-list: Public macros
Macro, with-environment: Public macros
make-option: Private ordinary functions
make-sub-command: Private ordinary functions
Method, bad-argument-type-option: Private generic functions
Method, bad-argument-type-type: Private generic functions
Method, not-enougth-pos-args-command: Private generic functions
Method, not-enougth-pos-args-count: Private generic functions
Method, not-enougth-pos-args-items: Private generic functions
Method, option-requires-argument-nargs: Private generic functions
Method, option-requires-argument-option: Private generic functions

N
not-enougth-pos-args-command: Private generic functions
not-enougth-pos-args-command: Private generic functions
not-enougth-pos-args-count: Private generic functions
not-enougth-pos-args-count: Private generic functions
not-enougth-pos-args-items: Private generic functions
not-enougth-pos-args-items: Private generic functions

O
opt-alias: Private ordinary functions
opt-default: Private ordinary functions
opt-help: Private ordinary functions
opt-long: Private ordinary functions
opt-name: Private ordinary functions
opt-params: Private ordinary functions
opt-type: Private ordinary functions
option-p: Private ordinary functions
option-requires-argument-nargs: Private generic functions
option-requires-argument-nargs: Private generic functions
option-requires-argument-option: Private generic functions
option-requires-argument-option: Private generic functions

P
parse-cli: Public ordinary functions
parse-command-args: Private ordinary functions
parse-commands: Private ordinary functions
parse-options: Private ordinary functions

R
run-command: Public ordinary functions

S
sub-command-p: Private ordinary functions
sub-docstring: Private ordinary functions
sub-func: Private ordinary functions
sub-options: Private ordinary functions
sub-positional: Private ordinary functions
sub-verbs: Private ordinary functions

V
version: Public ordinary functions

W
with-environment: Public macros