This is the unix-options Reference Manual, version 0.3.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 08:00:36 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
unix-options
Easy to use command line option parser
LLGPL
0.3.1
unix-options.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
unix-options/unix-options.lisp
unix-options
(system).
*default-usage-format-string*
(special variable).
cli-options
(function).
description
(reader method).
(setf description)
(writer method).
exe-name
(function).
getopt
(function).
long-tokens
(reader method).
(setf long-tokens)
(writer method).
make-load-form
(method).
make-option-spec
(function).
map-parsed-options
(function).
option-spec
(class).
parameter
(reader method).
(setf parameter)
(writer method).
print-usage-summary
(function).
short-tokens
(reader method).
(setf short-tokens)
(writer method).
with-cli-options
(macro).
add-option-spec
(macro).
add-token
(function).
aif
(macro).
all-long-tokens
(function).
all-short-tokens
(function).
all-tokens
(function).
alpha-numeric?
(function).
bad-option-warning
(condition).
concat
(function).
defrestart
(macro).
details
(reader method).
divide-tokens
(function).
doseq
(macro).
ensure-list
(function).
ensure-option-spec
(function).
filter
(function).
greater
(function).
greatest
(function).
make-normalized-option-spec
(function).
option
(reader method).
option-spec-length
(function).
option-spec-to-string
(function).
split-string
(function).
toggle-case
(function).
token?
(function).
tokens
(function).
tokens-from-symbol
(function).
with-gensyms
(macro).
Packages are listed by definition order.
unix-options
common-lisp
.
*default-usage-format-string*
(special variable).
cli-options
(function).
description
(generic reader).
(setf description)
(generic writer).
exe-name
(function).
getopt
(function).
long-tokens
(generic reader).
(setf long-tokens)
(generic writer).
make-option-spec
(function).
map-parsed-options
(function).
option-spec
(class).
parameter
(generic reader).
(setf parameter)
(generic writer).
print-usage-summary
(function).
short-tokens
(generic reader).
(setf short-tokens)
(generic writer).
with-cli-options
(macro).
add-option-spec
(macro).
add-token
(function).
aif
(macro).
all-long-tokens
(function).
all-short-tokens
(function).
all-tokens
(function).
alpha-numeric?
(function).
bad-option-warning
(condition).
concat
(function).
defrestart
(macro).
details
(generic reader).
divide-tokens
(function).
doseq
(macro).
ensure-list
(function).
ensure-option-spec
(function).
filter
(function).
greater
(function).
greatest
(function).
make-normalized-option-spec
(function).
option
(generic reader).
option-spec-length
(function).
option-spec-to-string
(function).
split-string
(function).
toggle-case
(function).
token?
(function).
tokens
(function).
tokens-from-symbol
(function).
with-gensyms
(macro).
Definitions are sorted by export status, category, package, and then by lexicographic order.
The macro automatically binds passed in command line options to a set of user defined variable names,
following the usual GNU conventions.
OPTION-VARIABLES is a lambda list, similar to a macro lambda list, of the form:
({option-variable}* [¶meters {option-variable}*] [&free free-token])
Each OPTION-VARIABLE is either a symbol or a lambda list of the form:
(symbol &optional option-spec)
The variable SYMBOL specifies the name of a value to be bound to some value passed in on the cli.
The symbol will be bound to the value of the parsed option, (either as a boolean representing
whether the option was passed, or as a string, representing the parameter passed, if the option
take parameters,) within the body of WITH-CLI-OPTIONS.
OPTION-SPEC is either an optional option-spec object, which defines how the tokens should be
interpreted to bind this value, or a list that defines one. If option spec is omitted, an
option-spec object is generated internally for this value, using the variable name (SYMBOL) as a
long-form token and the first letter as a short-form token. If the lowercase of the short-form
token is already taken, then the capital version is used. If this is also taken, the option will
have no default short-form token.
Alternatively, one may pass a string as OPTION-SPEC, in which case, the optoin-spec object will
still be generated from SYMBOL, but will use the string as the option description.
Option-variables listed after the &PARAMETERS modifier will be set as options which take a
parameter, unless overridden with an explicitly passed option-spec object.
Lastly, if the &FREE modifier is specified, it should be followed by exactly one symbol, which will be used as the name of the variable to be bound to the list of free tokens encountered after all other options.
list of tokens passed in at the cli
The command used to execute this program
A traditional command-line option parser of a similar general format
as getopt from the Unix cli. Return three values which are all
lists: (1) parsed command-line arguments with "–" separating the
valid options and free arguments, (2) only the valid options and (3)
only the free arguments. For example:
*cli-options* = ’("-afgo.txt" "–alpha" "stay.txt"
"–file" "return.txt" "loop.txt")
(getopts *cli-options* "af:j" ’("alpha" "file=")
=> ("a" "f" "go.txt" "alpha" "file" "return.txt" "–"
"stay.txt" "loop.txt")
("a" "f" "go.txt" "alpha" "file" "return.txt")
("stay.txt" "loop.txt")
Creates an option-spec object
A macro that parses a list of command line tokens according to a set of
conditions and allows the user to operate on them as a series of key/value pairs.
– cli-options: a tokenized command line with the executable name removed
– bool-options: a list of parameters that do not require values; these are either
true or false depending on wether they were passed in on the cli.
– param-options: a list of parameters that do require values; these are either false,
if not passed or the value of the next token in the list.
– opt-val-func: the code that operates on the key/value pairs; The code in this block is
executed for every found option name and it associated value (always true
for boolean parameters) bound to ’option’ and ’value’ respectively.
– free-opt-func: operates on free options not associated with any parameter
’map-parsed-options’ is meant as a backend for convenient option parsing mechanisms such
as ’with-cli-options’ and ’getopts’.
Given a description (a control string) and a list of specs for options descriptions
prints a usage summary. ’Description’ is a format control string, which is run
against a list of strings generated from the specs in ’option-specs’ each spec takes
the form of a list containing the following values in order:
short-opts - a string contain characters used as short options for this option
long-opt - either a single string, or a list of strings naming long options
parameter - If true, specifies that this option takes a parameter; parameter type
or description can be specified as a string
description - A short description of this option
option-spec
)) ¶option-spec
)) ¶A description of this option’s purpose and usage
option-spec
)) ¶option-spec
)) ¶A collection of all long tokens valid for this option
option-spec
)) ¶option-spec
)) ¶A boolean specifying whether this option takes a parameter.
Can be a string describing the parameter.
option-spec
)) ¶option-spec
)) ¶A collection of all short tokens valid for this option
option-spec
) &optional environment) ¶A collection of all short tokens valid for this option
:short-tokens
A collection of all long tokens valid for this option
:long-tokens
A boolean specifying whether this option takes a parameter.
Can be a string describing the parameter.
:parameter
A description of this option’s purpose and usage
""
:description
Returns true if ’char’ is a letter of the English alphabet or a numerical digit.
Takes a list of option specifications and returns two lists
of tokens: one from boolean option specs and one from parameter
option specs
Filters a list removing all element for which function returns nil
Checks the tokens of new-spec against the tokens in option-specs and changes or removes them to avoid conflicts
Calculates the length of the string necessary to print all of the tokens in a standard fashion
Returns a human readable string describing the option spec.
Reverses the case of a character
Tests if token is in option spec
Returns all tokens of option-spec
Returns a lowercase name of symbol and the lowercase first letter of that name
bad-option-warning
)) ¶bad-option-warning
)) ¶warning
.
Jump to: | (
A C D E F G L M O P S T W |
---|
Jump to: | (
A C D E F G L M O P S T W |
---|
Jump to: | *
D L O P S |
---|
Jump to: | *
D L O P S |
---|
Jump to: | B C F O P S U |
---|
Jump to: | B C F O P S U |
---|