The clesh Reference Manual

This is the clesh Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Feb 15 05:31:26 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 clesh

Clesh is a very short program that provides
mechanisms for running and composing Unix shell commands and constructs from Common Lisp.

Essentially, it provides a ’!’ syntax that you can use to run commands and a ’[]’ embedded mode where you can enter bash scripts and obtain the standard output as a lisp string, and some other features.

Lisp expressions can be included in any command or script using a ’?’ syntax.

Clesh works on every implementation of Common Lisp that is supported by trivial-shell.

Author

Christian von Essen <>

License

FreeBSD (see LICENSE)

Dependencies
  • trivial-shell (system).
  • named-readtables (system).
Source

clesh.asd.

Child Component

clesh.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 clesh/clesh.asd

Source

clesh.asd.

Parent Component

clesh (system).

ASDF Systems

clesh.


3.1.2 clesh/clesh.lisp

Source

clesh.asd.

Parent Component

clesh (system).

Packages

clesh.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 clesh

Source

clesh.lisp.

Nickname

clsh

Use List
  • common-lisp.
  • editor-hints.named-readtables.
  • trivial-shell.
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: *shell*

Program to use to execute shell commands.

Package

clesh.

Source

clesh.lisp.


5.1.2 Ordinary functions

Function: lines-to-list (text)

Transform the string TEXT into a list of strings, each representing
on line of TEXT. This is suitable to postprocessing the standard output of many Unix commands (such as find or df) that return one result per line.

Package

clesh.

Source

clesh.lisp.

Function: script (str &key program)

Execute the STR string as a standard input of the program.

Returns three values.
1. Standard output of the program
2. Standard error of the program
3. Exit code of the program

Package

clesh.

Source

clesh.lisp.


5.2 Internals


5.2.1 Ordinary functions

Function: embedded-shell-escape-reader (stream char)
Package

clesh.

Source

clesh.lisp.

Function: enter-shell-mode (stream)

Read and execute successive shell commands, with any
lisp expressions embedded. Expressions are evaluated at
read time, as soon as a line is delivered. Implements the !! reader macro.

Package

clesh.

Source

clesh.lisp.

Function: mixed-script (&rest strlist)

Concatenate arguments like MIXED-TEMPLATE, execute result like SCRIPT.

Returns three values.
1. Standard output of the program
2. Standard error of the program
3. Exit code of the program

Package

clesh.

Source

clesh.lisp.

Function: mixed-template (&rest strlist)

Concatenate list of arguments into a string.

Turns any argument that is not a string already into string using format’s ~A.

Package

clesh.

Source

clesh.lisp.

Function: read-escapes (str end-char1 buffer)

Read escapes, push the appropriate number of escapes onto the buffer. If the last character is special and not escaped, then this character is returned. Otherwise we return nil.

Package

clesh.

Source

clesh.lisp.

Function: read-interpolated-string (str end-char1 &optional end-char2 eval-at-read)

Read from a stream until a delimiter is found and interpolate.

The delimiter is
- the character END-CHAR1 if END-CHAR2 is nil
- the sequence END-CHAR2 END-CHAR1 if END-CHAR2 is not nil.

Interpolation starts with ?, and the next form (i.e., lisp form)
is interpolated. If EVAL-AT-READ is not NIL, then the form will
be evaluated and converted into a string immediately.
Otherwise the form will be returned as is.

Returns a list. In this list, normal strings and interpolations alternate. For example the string "asd foo ?(+ 2 2) bar ?(+ 3 3)"
will be read as ("asd foo " (+ 2 2) " bar " (+ 3 3)).

Package

clesh.

Source

clesh.lisp.

Function: simple-shell-escape-reader (stream char)
Package

clesh.

Source

clesh.lisp.

Function: storable-template-escape-reader (stream char1 char2)
Package

clesh.

Source

clesh.lisp.

Function: template-escape-reader (stream char1 char2)
Package

clesh.

Source

clesh.lisp.


Appendix A Indexes


A.1 Concepts


A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*shell*: Public special variables

S
Special Variable, *shell*: Public special variables