The utility-arguments Reference Manual

This is the utility-arguments Reference Manual, version 0.161029, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 08:01:06 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 utility-arguments

Utility to handle command-line arguments.

Author

Frank A. U.

Contact

License

ICS

Version

0.161029

Dependency

alexandria (system).

Source

utility-arguments.asd.

Child Components

3 Files

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


3.1 Lisp


3.1.1 utility-arguments/utility-arguments.asd

Source

utility-arguments.asd.

Parent Component

utility-arguments (system).

ASDF Systems

utility-arguments.


3.1.2 utility-arguments/packages.lisp

Source

utility-arguments.asd.

Parent Component

utility-arguments (system).

Packages

utility-arguments.


3.1.3 utility-arguments/utils.lisp

Dependency

packages.lisp (file).

Source

utility-arguments.asd.

Parent Component

utility-arguments (system).

Internals

3.1.4 utility-arguments/error.lisp

Dependency

utils.lisp (file).

Source

utility-arguments.asd.

Parent Component

utility-arguments (system).

Public Interface
Internals

3.1.5 utility-arguments/option.lisp

Dependency

error.lisp (file).

Source

utility-arguments.asd.

Parent Component

utility-arguments (system).

Public Interface
Internals

3.1.6 utility-arguments/parser.lisp

Dependency

option.lisp (file).

Source

utility-arguments.asd.

Parent Component

utility-arguments (system).

Public Interface

*separator* (special variable).

Internals

3.1.7 utility-arguments/operand.lisp

Dependency

parser.lisp (file).

Source

utility-arguments.asd.

Parent Component

utility-arguments (system).

Public Interface
Internals

3.1.8 utility-arguments/usage.lisp

Dependency

operand.lisp (file).

Source

utility-arguments.asd.

Parent Component

utility-arguments (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 utility-arguments

Source

packages.lisp.

Use List
  • alexandria.
  • 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 Special variables

Special Variable: *separator*

Character that separates the arguments in a sequence. Setting it to nil, disables separation.

Package

utility-arguments.

Source

parser.lisp.


5.1.2 Macros

Macro: defusage (name (operand-lambda-list option-lambda-list) &body body)

Define a new usage for operands and options.

NAME is a symbol and denotes the name of the usage.

OPERAND-LAMBDA-LIST describes operands. It resembles a lambda list with required, optional, or rest parameter specifiers as the only elements allowed. The parameters receive the operands’ values.

OPTION-LAMBDA-LIST describes options. It resembles a lambda list with keyword and rest parameter specifiers as the only elements allowed. The parameters receive the options’ values.

Optional and keyword parameter that specify an init-form make it optional in this usage.

The forms of BODY are executed when the usage is applied.

Package

utility-arguments.

Source

usage.lisp.


5.1.3 Ordinary functions

Function: apply-usage (usages operands options utility-arguments)

Apply a usage to utility arguments.

USAGES is a list of symbols naming usages defined with defusage.

The lists OPERANDS and OPTIONS hold objects that complement the parameters on usage lambda lists in providing additional type and syntactic information. Correlation is established by object key and parameter name.

UTILITY-ARGUMENTS is a list of strings that is parsed into operands and options. The operand and options are matched against the usage lambda lists to find a suitable usage which is then applied to the operand’s and option’s values.

An error condition of utility-argument-error, no-such-usage, or usage-conflict may be signaled.

Package

utility-arguments.

Source

usage.lisp.

Function: find-operand (key operands)

Find operand identifiable by KEY.

KEY is a symbol. OPERANDS is a list of operand objects.

Package

utility-arguments.

Source

operand.lisp.

Function: make-operand (&key key type)

Make a new operand.

KEY is a symbol that correlates the operand with a positional parameter on a usage lambda list.

The parameter TYPE is documented in make-option-with-argument.

Package

utility-arguments.

Source

operand.lisp.

Function: make-option-flag (&key key short long)

Make a new option flag.

Its number of appearances on a utility argument list is the assumed value.

The parameters KEY, SHORT, and LONG are documented in make-option-with-argument.

Package

utility-arguments.

Source

option.lisp.

Function: make-option-with-argument (&key key short long type)

Make a new option that receives one argument.

KEY is a symbol that correlates the option with a keyword parameter on a usage lambda list.

SHORT is a case-sensitive character. LONG is a case-insensitive but case-preserving string. Both designators are equivalent and request the option on a utility argument list. At least one of the two must be specified.

TYPE is a Lisp type specifier the object must conform to the Lisp reader builds from the received argument. The built object becomes the assumed value.

TYPE is a function of two string arguments: the first of which is the received argument for the option, and the second the designator that requested the option. The object returned becomes the assumed value.

TYPE is nil, the received argument is the assumed value.

Package

utility-arguments.

Source

option.lisp.

Function: make-option-with-optional-argument (&key key short long type)

Make a new option that optionally receives one argument.

If the option doesn’t receive an argument, nil is assumed.

The parameters KEY, SHORT, LONG, and TYPE are documented in make-option-with-argument.

Package

utility-arguments.

Source

option.lisp.

Function: make-option-with-optional-sequence (&key key short long type)

Make a new option that optionally receives a sequence of arguments.

If the option doesn’t receive an argument, nil is assumed. See also make-option-with-sequence.

The parameters KEY, SHORT, LONG, and TYPE are documented in make-option-with-argument.

Package

utility-arguments.

Source

option.lisp.

Function: make-option-with-sequence (&key key short long type)

Make a new option that receives a sequence of arguments.

Multiple arguments in a sequence are separated from each other by the separator registered with *separator*.

Received arguments are subject to type parsing as described in make-option-with-argument. The assumed values are collected into a list by order of utility arguments.

The parameters KEY, SHORT, LONG, and TYPE are documented in make-option-with-argument.

Package

utility-arguments.

Source

option.lisp.

Function: no-such-usage (utility-arguments)
Package

utility-arguments.

Source

error.lisp.

Function: usage-conflict (usages)
Package

utility-arguments.

Source

error.lisp.

Function: utility-argument-error (control &rest arguments)
Package

utility-arguments.

Source

error.lisp.


5.1.4 Generic functions

Generic Reader: conflicting-usages (condition)
Package

utility-arguments.

Methods
Reader Method: conflicting-usages ((condition usage-conflict))
Source

error.lisp.

Target Slot

usages.

Generic Function: find-option (item options)

Find option identifiable by ITEM.

ITEM is either a symbol, character, or a string. OPTIONS is a list of option objects.

Package

utility-arguments.

Source

option.lisp.

Methods
Method: find-option ((long string) options)
Method: find-option ((short character) options)
Method: find-option ((key symbol) options)
Generic Reader: utility-arguments (condition)
Package

utility-arguments.

Methods
Reader Method: utility-arguments ((condition no-such-usage))
Source

error.lisp.

Target Slot

utility-arguments.


5.1.5 Standalone methods

Method: initialize-instance :after ((self option) &key key short long)
Source

option.lisp.

Method: initialize-instance :after ((self operand) &key key)
Source

operand.lisp.


5.1.6 Conditions

Condition: no-such-usage

Condition signaled if no suitable usage was found.

Package

utility-arguments.

Source

error.lisp.

Direct superclasses

usage-error.

Direct methods

utility-arguments.

Direct slots
Slot: utility-arguments
Initargs

:utility-arguments

Readers

utility-arguments.

Writers

This slot is read-only.

Condition: usage-conflict

Condition signaled if more than one suitable usage was found.

Package

utility-arguments.

Source

error.lisp.

Direct superclasses

usage-error.

Direct methods

conflicting-usages.

Direct slots
Slot: usages
Initargs

:usages

Readers

conflicting-usages.

Writers

This slot is read-only.

Condition: usage-error

Condition signaled for usage related errors.

Package

utility-arguments.

Source

error.lisp.

Direct superclasses

error.

Direct subclasses
Condition: utility-argument-error

Condition signaled for utility argument related errors, such as bad syntax, unknown options, or type errors.

Package

utility-arguments.

Source

error.lisp.

Direct superclasses

error.

Direct methods

utility-argument-error-text.

Direct slots
Slot: text
Initargs

:text

Readers

utility-argument-error-text.

Writers

This slot is read-only.


5.2 Internals


5.2.1 Ordinary functions

Function: allow-other-keys-lambda? (lambda-list)
Package

utility-arguments.

Source

utils.lisp.

Function: blank? (char)
Package

utility-arguments.

Source

utils.lisp.

Function: complete-usage (arity keys usages)
Package

utility-arguments.

Source

usage.lisp.

Function: csv (string)
Package

utility-arguments.

Source

parser.lisp.

Function: end-of-options? (string)
Package

utility-arguments.

Source

parser.lisp.

Function: excessive-option-arguments (designator arguments)
Package

utility-arguments.

Source

error.lisp.

Function: find-all-usages (arity keys usages)
Package

utility-arguments.

Source

usage.lisp.

Function: invalid-operand-argument (designator argument type)
Package

utility-arguments.

Source

error.lisp.

Function: invalid-option-argument (designator argument type)
Package

utility-arguments.

Source

error.lisp.

Function: lambda-arity (lambda-list)
Package

utility-arguments.

Source

utils.lisp.

Function: lambda-key-parameters (lambda-list)
Package

utility-arguments.

Source

utils.lisp.

Function: lambda-variables (lambda-list)
Package

utility-arguments.

Source

utils.lisp.

Function: long-option? (string)
Package

utility-arguments.

Source

parser.lisp.

Function: missing-option-argument (designator)
Package

utility-arguments.

Source

error.lisp.

Function: no-such-option (literal)
Package

utility-arguments.

Source

error.lisp.

Function: normalize-space (string)
Package

utility-arguments.

Source

utils.lisp.

Function: operand-lambda-list (usage)
Package

utility-arguments.

Source

usage.lisp.

Function: option-lambda-list (usage)
Package

utility-arguments.

Source

usage.lisp.

Function: parse-long-spec (spec utility-arguments options plist)
Package

utility-arguments.

Source

parser.lisp.

Function: parse-operand-argument (argument operand)
Package

utility-arguments.

Source

operand.lisp.

Function: parse-operands (operands arguments usage)
Package

utility-arguments.

Source

usage.lisp.

Function: parse-option-argument (string option designator)
Package

utility-arguments.

Source

option.lisp.

Function: parse-short-spec (spec utility-arguments options plist)
Package

utility-arguments.

Source

parser.lisp.

Function: parse-utility-arguments (utility-arguments options)
Package

utility-arguments.

Source

parser.lisp.

Function: plist-keys (plist)
Package

utility-arguments.

Source

utils.lisp.

Function: plist-keys-if (predicate plist)
Package

utility-arguments.

Source

utils.lisp.

Function: separate (sequence separator)
Package

utility-arguments.

Source

utils.lisp.

Function: short-option? (string)
Package

utility-arguments.

Source

parser.lisp.

Function: split-at (sequence position)
Package

utility-arguments.

Source

utils.lisp.

Function: split-long-spec (string)
Package

utility-arguments.

Source

parser.lisp.

Function: syntax-error (literal)
Package

utility-arguments.

Source

error.lisp.

Function: trim-space (string)
Package

utility-arguments.

Source

utils.lisp.


5.2.2 Generic functions

Generic Function: parse-option (option designator plist utility-arguments argument)
Package

utility-arguments.

Source

parser.lisp.

Methods
Method: parse-option ((self option-with-optional-sequence) designator plist utility-arguments argument)
Method: parse-option ((self option-with-sequence) designator plist utility-arguments argument)
Method: parse-option ((self option-with-optional-argument) designator plist utility-arguments argument)
Method: parse-option ((self option-with-argument) designator plist utility-arguments argument)
Method: parse-option ((self option-flag) designator plist utility-arguments argument)
Generic Reader: utility-argument-error-text (condition)
Package

utility-arguments.

Methods
Reader Method: utility-argument-error-text ((condition utility-argument-error))
Source

error.lisp.

Target Slot

text.


5.2.3 Classes

Class: operand
Package

utility-arguments.

Source

operand.lisp.

Direct methods

initialize-instance.

Direct slots
Slot: key
Initargs

:key

Slot: type
Package

common-lisp.

Initargs

:type

Class: option
Package

utility-arguments.

Source

option.lisp.

Direct subclasses
Direct methods

initialize-instance.

Direct slots
Slot: key
Initargs

:key

Slot: short
Initargs

:short

Slot: long
Initargs

:long

Slot: type
Package

common-lisp.

Initargs

:type

Class: option-flag
Package

utility-arguments.

Source

option.lisp.

Direct superclasses

option.

Direct methods

parse-option.

Class: option-with-argument
Package

utility-arguments.

Source

option.lisp.

Direct superclasses

option.

Direct methods

parse-option.

Class: option-with-optional-argument
Package

utility-arguments.

Source

option.lisp.

Direct superclasses

option.

Direct methods

parse-option.

Class: option-with-optional-sequence
Package

utility-arguments.

Source

option.lisp.

Direct superclasses

option.

Direct methods

parse-option.

Class: option-with-sequence
Package

utility-arguments.

Source

option.lisp.

Direct superclasses

option.

Direct methods

parse-option.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   A   B   C   D   E   F   G   I   L   M   N   O   P   S   T   U  
Index Entry  Section

A
allow-other-keys-lambda?: Private ordinary functions
apply-usage: Public ordinary functions

B
blank?: Private ordinary functions

C
complete-usage: Private ordinary functions
conflicting-usages: Public generic functions
conflicting-usages: Public generic functions
csv: Private ordinary functions

D
defusage: Public macros

E
end-of-options?: Private ordinary functions
excessive-option-arguments: Private ordinary functions

F
find-all-usages: Private ordinary functions
find-operand: Public ordinary functions
find-option: Public generic functions
find-option: Public generic functions
find-option: Public generic functions
find-option: Public generic functions
Function, allow-other-keys-lambda?: Private ordinary functions
Function, apply-usage: Public ordinary functions
Function, blank?: Private ordinary functions
Function, complete-usage: Private ordinary functions
Function, csv: Private ordinary functions
Function, end-of-options?: Private ordinary functions
Function, excessive-option-arguments: Private ordinary functions
Function, find-all-usages: Private ordinary functions
Function, find-operand: Public ordinary functions
Function, invalid-operand-argument: Private ordinary functions
Function, invalid-option-argument: Private ordinary functions
Function, lambda-arity: Private ordinary functions
Function, lambda-key-parameters: Private ordinary functions
Function, lambda-variables: Private ordinary functions
Function, long-option?: Private ordinary functions
Function, make-operand: Public ordinary functions
Function, make-option-flag: Public ordinary functions
Function, make-option-with-argument: Public ordinary functions
Function, make-option-with-optional-argument: Public ordinary functions
Function, make-option-with-optional-sequence: Public ordinary functions
Function, make-option-with-sequence: Public ordinary functions
Function, missing-option-argument: Private ordinary functions
Function, no-such-option: Private ordinary functions
Function, no-such-usage: Public ordinary functions
Function, normalize-space: Private ordinary functions
Function, operand-lambda-list: Private ordinary functions
Function, option-lambda-list: Private ordinary functions
Function, parse-long-spec: Private ordinary functions
Function, parse-operand-argument: Private ordinary functions
Function, parse-operands: Private ordinary functions
Function, parse-option-argument: Private ordinary functions
Function, parse-short-spec: Private ordinary functions
Function, parse-utility-arguments: Private ordinary functions
Function, plist-keys: Private ordinary functions
Function, plist-keys-if: Private ordinary functions
Function, separate: Private ordinary functions
Function, short-option?: Private ordinary functions
Function, split-at: Private ordinary functions
Function, split-long-spec: Private ordinary functions
Function, syntax-error: Private ordinary functions
Function, trim-space: Private ordinary functions
Function, usage-conflict: Public ordinary functions
Function, utility-argument-error: Public ordinary functions

G
Generic Function, conflicting-usages: Public generic functions
Generic Function, find-option: Public generic functions
Generic Function, parse-option: Private generic functions
Generic Function, utility-argument-error-text: Private generic functions
Generic Function, utility-arguments: Public generic functions

I
initialize-instance: Public standalone methods
initialize-instance: Public standalone methods
invalid-operand-argument: Private ordinary functions
invalid-option-argument: Private ordinary functions

L
lambda-arity: Private ordinary functions
lambda-key-parameters: Private ordinary functions
lambda-variables: Private ordinary functions
long-option?: Private ordinary functions

M
Macro, defusage: Public macros
make-operand: Public ordinary functions
make-option-flag: Public ordinary functions
make-option-with-argument: Public ordinary functions
make-option-with-optional-argument: Public ordinary functions
make-option-with-optional-sequence: Public ordinary functions
make-option-with-sequence: Public ordinary functions
Method, conflicting-usages: Public generic functions
Method, find-option: Public generic functions
Method, find-option: Public generic functions
Method, find-option: Public generic functions
Method, initialize-instance: Public standalone methods
Method, initialize-instance: Public standalone methods
Method, parse-option: Private generic functions
Method, parse-option: Private generic functions
Method, parse-option: Private generic functions
Method, parse-option: Private generic functions
Method, parse-option: Private generic functions
Method, utility-argument-error-text: Private generic functions
Method, utility-arguments: Public generic functions
missing-option-argument: Private ordinary functions

N
no-such-option: Private ordinary functions
no-such-usage: Public ordinary functions
normalize-space: Private ordinary functions

O
operand-lambda-list: Private ordinary functions
option-lambda-list: Private ordinary functions

P
parse-long-spec: Private ordinary functions
parse-operand-argument: Private ordinary functions
parse-operands: Private ordinary functions
parse-option: Private generic functions
parse-option: Private generic functions
parse-option: Private generic functions
parse-option: Private generic functions
parse-option: Private generic functions
parse-option: Private generic functions
parse-option-argument: Private ordinary functions
parse-short-spec: Private ordinary functions
parse-utility-arguments: Private ordinary functions
plist-keys: Private ordinary functions
plist-keys-if: Private ordinary functions

S
separate: Private ordinary functions
short-option?: Private ordinary functions
split-at: Private ordinary functions
split-long-spec: Private ordinary functions
syntax-error: Private ordinary functions

T
trim-space: Private ordinary functions

U
usage-conflict: Public ordinary functions
utility-argument-error: Public ordinary functions
utility-argument-error-text: Private generic functions
utility-argument-error-text: Private generic functions
utility-arguments: Public generic functions
utility-arguments: Public generic functions


A.4 Data types

Jump to:   C   E   F   N   O   P   S   U  
Index Entry  Section

C
Class, operand: Private classes
Class, option: Private classes
Class, option-flag: Private classes
Class, option-with-argument: Private classes
Class, option-with-optional-argument: Private classes
Class, option-with-optional-sequence: Private classes
Class, option-with-sequence: Private classes
Condition, no-such-usage: Public conditions
Condition, usage-conflict: Public conditions
Condition, usage-error: Public conditions
Condition, utility-argument-error: Public conditions

E
error.lisp: The utility-arguments/error․lisp file

F
File, error.lisp: The utility-arguments/error․lisp file
File, operand.lisp: The utility-arguments/operand․lisp file
File, option.lisp: The utility-arguments/option․lisp file
File, packages.lisp: The utility-arguments/packages․lisp file
File, parser.lisp: The utility-arguments/parser․lisp file
File, usage.lisp: The utility-arguments/usage․lisp file
File, utility-arguments.asd: The utility-arguments/utility-arguments․asd file
File, utils.lisp: The utility-arguments/utils․lisp file

N
no-such-usage: Public conditions

O
operand: Private classes
operand.lisp: The utility-arguments/operand․lisp file
option: Private classes
option-flag: Private classes
option-with-argument: Private classes
option-with-optional-argument: Private classes
option-with-optional-sequence: Private classes
option-with-sequence: Private classes
option.lisp: The utility-arguments/option․lisp file

P
Package, utility-arguments: The utility-arguments package
packages.lisp: The utility-arguments/packages․lisp file
parser.lisp: The utility-arguments/parser․lisp file

S
System, utility-arguments: The utility-arguments system

U
usage-conflict: Public conditions
usage-error: Public conditions
usage.lisp: The utility-arguments/usage․lisp file
utility-argument-error: Public conditions
utility-arguments: The utility-arguments system
utility-arguments: The utility-arguments package
utility-arguments.asd: The utility-arguments/utility-arguments․asd file
utils.lisp: The utility-arguments/utils․lisp file