Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the cl-shellwords Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Jun 15 04:02:34 2022 GMT+0.
Next: Systems, Previous: The cl-shellwords Reference Manual, Up: The cl-shellwords Reference Manual [Contents][Index]
CL-shellwords is a port of Ruby's shellwords.rb to Common Lisp. It can be used to escape strings for use on the (Bourne) shell, or to split command lines into segments according to the shell's escaping rules.
CL-shellwords depends only on CL-PPCRE (BSD). The tests additionally depend on Prove (MIT).
CL-shellwords defines the package :cl-shellwords
, with the alias :shellwords
. This package exports three functions, a condition and an accessor for that condition.
(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
.
(escape string)
Escape STRING
so that it is safe when used as an argument in a shell like
the Bourne shell.
STRING
is an empty string, a pair of single quotes is returned.Examples:
(escape "")
;=> "''"
(escape "It's an example string")
;=> "It\s\ an\ example\ string"
(escape "NothingWrongHere")
;=> "NothingWrongHere"
(escape "{LF}")
;=> "'{LF}'" ({LF} = #\linefeed)
(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.
Copyright (c) 2015 Joram Schrijver
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Next: Files, Previous: Introduction, Up: The cl-shellwords Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
Common Lisp port of Ruby’s shellwords.rb, for escaping and splitting strings to be passed to a shell.
Joram Schrijver <i@joram.io>
MIT
0.1
cl-ppcre (system).
shellwords.lisp (file).
Next: Packages, Previous: Systems, Up: The cl-shellwords Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: cl-shellwords/shellwords.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
cl-shellwords (system).
Previous: cl-shellwords/cl-shellwords.asd, Up: Lisp [Contents][Index]
cl-shellwords (system).
+split-regexp+ (special variable).
Next: Definitions, Previous: Files, Up: The cl-shellwords Reference Manual [Contents][Index]
Packages are listed by definition order.
shellwords
common-lisp.
+split-regexp+ (special variable).
Next: Indexes, Previous: Packages, Up: The cl-shellwords Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Next: Generic functions, Previous: Public Interface, Up: Public Interface [Contents][Index]
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)
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.
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.
Next: Conditions, Previous: Ordinary functions, Up: Public Interface [Contents][Index]
Previous: Generic functions, Up: Public Interface [Contents][Index]
simple-error.
common-lisp.
:string
This slot is read-only.
Previous: Public Interface, Up: Definitions [Contents][Index]
Previous: Definitions, Up: The cl-shellwords Reference Manual [Contents][Index]
Jump to: | E F G J M S U |
---|
Jump to: | E F G J M S U |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | +
S |
---|
Index Entry | Section | ||
---|---|---|---|
| |||
+ | |||
+split-regexp+ : | Private special variables | ||
| |||
S | |||
Slot, string : | Public conditions | ||
Special Variable, +split-regexp+ : | Private special variables | ||
string : | Public conditions | ||
|
Jump to: | +
S |
---|
Jump to: | C F P S U |
---|
Jump to: | C F P S U |
---|