The cl-shellwords Reference Manual

This is the cl-shellwords Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 15:42:46 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 cl-shellwords

Common Lisp port of Ruby’s shellwords.rb, for escaping and splitting strings to be passed to a shell.

Author

Joram Schrijver <>

License

MIT

Version

0.1

Dependency

cl-ppcre (system).

Source

cl-shellwords.asd.

Child Component

shellwords.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-shellwords/cl-shellwords.asd

Source

cl-shellwords.asd.

Parent Component

cl-shellwords (system).

ASDF Systems

cl-shellwords.


3.1.2 cl-shellwords/shellwords.lisp

Source

cl-shellwords.asd.

Parent Component

cl-shellwords (system).

Packages

cl-shellwords.

Public Interface
Internals

+split-regexp+ (special variable).


4 Packages

Packages are listed by definition order.


4.1 cl-shellwords

Source

shellwords.lisp.

Nickname

shellwords

Use List

common-lisp.

Public Interface
Internals

+split-regexp+ (special variable).


5 Definitions

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


5.1 Public Interface


5.1.1 Ordinary functions

Function: escape (string)

Escape STRING so that it is safe when used as an argument in a shell like the Bourne shell.

- If STRING is an empty string, a pair of single quotes is returned. - An LF character is escaped by placing it in single quotes.
- All other special characters are escaped with a backslash.

Examples:
(escape "") ;=> "”"
(escape "It’s an example string") ;=> "It\s\ an\ example\ string" (escape "NothingWrongHere") ;=> "NothingWrongHere"
(escape "{LF}") ;=> "’{LF}’" ({LF} = #\linefeed)

Package

cl-shellwords.

Source

shellwords.lisp.

Function: join (sequence)

Join the elements of SEQUENCE together, separated by spaces. The elements are first passed to ESCAPE for proper escaping.

SEQUENCE should be a list or vector of strings.

Package

cl-shellwords.

Source

shellwords.lisp.

Function: split (string)

Split STRING into a list of words, handling escaping the same way a shell like the Bourne shell does.

Whitespace normally acts as a word separator, except when preceded by a backslash or enclosed in single- or double quotes.

Examples:
(split "example string") ;=> ("example" "string") (split "example\ escaped string") ;=> ("example escaped" "string") (split "example ’escaped string’") ;=> ("example" "escaped string") (split "example "escaped string"") ;=> ("example" "escaped string")

If STRING contains non-matching single- or double quotes, an error of type UNMATCHED-QUOTE-ERROR is signaled. STRING can be retrieved from the error object using UNMATCHED-QUOTE-ERROR-STRING.

Package

cl-shellwords.

Source

shellwords.lisp.


5.1.2 Generic functions

Generic Reader: unmatched-quote-error-string (condition)
Package

cl-shellwords.

Methods
Reader Method: unmatched-quote-error-string ((condition unmatched-quote-error))
Source

shellwords.lisp.

Target Slot

string.


5.1.3 Conditions

Condition: unmatched-quote-error
Package

cl-shellwords.

Source

shellwords.lisp.

Direct superclasses

simple-error.

Direct methods

unmatched-quote-error-string.

Direct slots
Slot: string
Package

common-lisp.

Initargs

:string

Readers

unmatched-quote-error-string.

Writers

This slot is read-only.


5.2 Internals


5.2.1 Special variables

Special Variable: +split-regexp+
Package

cl-shellwords.

Source

shellwords.lisp.


Appendix A Indexes


A.1 Concepts


A.3 Variables