The trivial-toplevel-commands Reference Manual

This is the trivial-toplevel-commands Reference Manual, version 0.0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:57:41 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 trivial-toplevel-commands

Trivial Toplevel Commands allows to define toplevel commands available on most implementations in a portable fashion.

Author

Artyom Bologov

Home Page

https://github.com/aartaka/trivial-toplevel-commands

Source Control

(GIT https://github.com/aartaka/trivial-toplevel-commands.git)

Bug Tracker

https://github.com/aartaka/trivial-toplevel-commands/issues

License

BSD-3 Clause

Version

0.0.1

Source

trivial-toplevel-commands.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 trivial-toplevel-commands/trivial-toplevel-commands.asd

Source

trivial-toplevel-commands.asd.

Parent Component

trivial-toplevel-commands (system).

ASDF Systems

trivial-toplevel-commands.


3.1.3 trivial-toplevel-commands/commands.lisp

Dependency

package.lisp (file).

Source

trivial-toplevel-commands.asd.

Parent Component

trivial-toplevel-commands (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 trivial-toplevel-commands

‘trivial-toplevel-commands’ allows (un)defining new toplevel commands.

There are three macros defining new commands:

- ‘define-command/string’ to define commands that process a single string argument—the rest of the command invocation.
- ‘define-command/read’ macro binds a new command that processed the arguments passed to it without evaluating them.
- And ‘define-command/eval’ doing the same but with arguments evaluated.
- Shorter ‘defcommand/*’ versions are available too.

‘remove-command’ unbinds the defined command. By full name or alias.

‘command-alias’, ‘command-name’, and ‘command-handler’ allow to get the name, alias, and handler of command by name/alias.

See function/macro docstrings and README file for usage examples.

TODO: Examples should belong to macros/functions/package themselves, not to the README...

Source

package.lisp.

Nicknames
  • toplevel-commands
  • tpl-cmds
  • tpl-cmd
Use List

common-lisp.

Public Interface
Internals

4.2 trivial-toplevel-commands/commands

Package to INTERN command names to.

Source

package.lisp.

Use List

common-lisp.


5 Definitions

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


5.1 Public Interface


5.1.1 Macros

Macro: defcommand (name (&rest arguments) &body documentation)

Define NAME command running BODY with raw ‘read’ s-exprs as ARGUMENTS.

For more info, see ‘define-command/string’.

Package

trivial-toplevel-commands.

Alias for

define-command/read.

Macro: defcommand/eval (name arguments &body documentation)

Define NAME command running BODY with ‘eval’-uated ARGUMENTS.

For more info, see ‘define-command/string’.

Package

trivial-toplevel-commands.

Alias for

define-command/eval.

Macro: defcommand/read (name (&rest arguments) &body documentation)

Define NAME command running BODY with raw ‘read’ s-exprs as ARGUMENTS.

For more info, see ‘define-command/string’.

Package

trivial-toplevel-commands.

Alias for

define-command/read.

Macro: defcommand/string (name (&optional argument actual-arglist) &body documentation)

Define NAME command running BODY with string command ARGUMENT.

ARGUMENT is always a string, even if empty one.
- For command ":foo abc", the ARGUMENT is "abc".
- For command ":foo", the ARGUMENT is "".

NAME is either:
- A single symbol—full name of the new command.
- A (FULL-NAME ALIAS) list—for the aliased command.

In case NAME matches an existing command, redefine it.

DOCUMENTATION docstring should have a one-line executive summary as the first line. That’s what most implementations will show alongside the command name/alias. The rest of the DOCUMENTATION is additional details, which might or might not get attached to the generated command handler, but aren’t guaranteed to be anywhere, especially across implementations.

SBCL quirk: new command is only accessible in break/debug loop or via ACLREPL contrib:

(require "sb-aclrepl")

Package

trivial-toplevel-commands.

Alias for

define-command/string.

Macro: define-command (name (&rest arguments) &body documentation)

Define NAME command running BODY with raw ‘read’ s-exprs as ARGUMENTS.

For more info, see ‘define-command/string’.

Package

trivial-toplevel-commands.

Alias for

define-command/read.

Macro: define-command/eval (name arguments &body documentation)

Define NAME command running BODY with ‘eval’-uated ARGUMENTS.

For more info, see ‘define-command/string’.

Package

trivial-toplevel-commands.

Source

commands.lisp.

Macro: define-command/read (name (&rest arguments) &body documentation)

Define NAME command running BODY with raw ‘read’ s-exprs as ARGUMENTS.

For more info, see ‘define-command/string’.

Package

trivial-toplevel-commands.

Source

commands.lisp.

Macro: define-command/string (name (&optional argument actual-arglist) &body documentation)

Define NAME command running BODY with string command ARGUMENT.

ARGUMENT is always a string, even if empty one.
- For command ":foo abc", the ARGUMENT is "abc".
- For command ":foo", the ARGUMENT is "".

NAME is either:
- A single symbol—full name of the new command.
- A (FULL-NAME ALIAS) list—for the aliased command.

In case NAME matches an existing command, redefine it.

DOCUMENTATION docstring should have a one-line executive summary as the first line. That’s what most implementations will show alongside the command name/alias. The rest of the DOCUMENTATION is additional details, which might or might not get attached to the generated command handler, but aren’t guaranteed to be anywhere, especially across implementations.

SBCL quirk: new command is only accessible in break/debug loop or via ACLREPL contrib:

(require "sb-aclrepl")

Package

trivial-toplevel-commands.

Source

commands.lisp.


5.1.2 Ordinary functions

Function: command-alias (name-or-alias)

Get the alias for NAME-OR-ALIASed command.

Package

trivial-toplevel-commands.

Source

commands.lisp.

Function: command-handler (name-or-alias)
Package

trivial-toplevel-commands.

Source

commands.lisp.

Function: command-name (name-or-alias)

Get the name for NAME-OR-ALIASed command.

Package

trivial-toplevel-commands.

Source

commands.lisp.

Function: remove-command (name-or-alias)

Remove a previously defined toplevel command by NAME-OR-ALIAS. Can also remove built-in toplevel command (except when on CLISP.)

Package

trivial-toplevel-commands.

Source

commands.lisp.


5.1.3 Generic functions

Generic Function: command-char (&optional char)

Return current command char or set it to CHAR (when provided).

Package

trivial-toplevel-commands.

Source

commands.lisp.

Methods
Method: command-char (&optional char)
Generic Function: (setf command-char) (&optional char)
Package

trivial-toplevel-commands.

Source

commands.lisp.

Methods
Method: (setf command-char) (&optional char)

5.2 Internals


5.2.1 Special variables

Special Variable: alias->name

Table to find command name by alias. Useful for ‘remove-command’.

Package

trivial-toplevel-commands.

Source

commands.lisp.

Special Variable: name->alias

Table to find command alias by name. Useful for ‘remove-command’.

Package

trivial-toplevel-commands.

Source

commands.lisp.

Special Variable: name->handler

Table to find actual command handler (symbol) by name. Useful for ‘command-handler’.

Package

trivial-toplevel-commands.

Source

commands.lisp.


5.2.2 Ordinary functions

Function: string-slurp-forms (string)
Package

trivial-toplevel-commands.

Source

commands.lisp.

Function: toplevel-name (name)
Package

trivial-toplevel-commands.

Source

commands.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
C   D   F   G   M   R   S   T  
Index Entry  Section

(
(setf command-char): Public generic functions
(setf command-char): Public generic functions

C
command-alias: Public ordinary functions
command-char: Public generic functions
command-char: Public generic functions
command-handler: Public ordinary functions
command-name: Public ordinary functions

D
defcommand: Public macros
defcommand/eval: Public macros
defcommand/read: Public macros
defcommand/string: Public macros
define-command: Public macros
define-command/eval: Public macros
define-command/read: Public macros
define-command/string: Public macros

F
Function, command-alias: Public ordinary functions
Function, command-handler: Public ordinary functions
Function, command-name: Public ordinary functions
Function, remove-command: Public ordinary functions
Function, string-slurp-forms: Private ordinary functions
Function, toplevel-name: Private ordinary functions

G
Generic Function, (setf command-char): Public generic functions
Generic Function, command-char: Public generic functions

M
Macro, defcommand: Public macros
Macro, defcommand/eval: Public macros
Macro, defcommand/read: Public macros
Macro, defcommand/string: Public macros
Macro, define-command: Public macros
Macro, define-command/eval: Public macros
Macro, define-command/read: Public macros
Macro, define-command/string: Public macros
Method, (setf command-char): Public generic functions
Method, command-char: Public generic functions

R
remove-command: Public ordinary functions

S
string-slurp-forms: Private ordinary functions

T
toplevel-name: Private ordinary functions