This is the replic Reference Manual, version 0.12, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 06:35:50 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
replic
A framework to build readline applications out of existing code.
vindarel
MIT
0.12
cl-readline
(system).
str
(system).
cl-ansi-text
(system).
unix-opts
(system).
py-configparser
(system).
shlex
(system).
src
(module).
Modules are listed depth-first from the system components tree.
replic/src
replic
(system).
utils.lisp
(file).
completion.lisp
(file).
config.lisp
(file).
replic.lisp
(file).
help.lisp
(file).
base.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
replic/replic.asd
replic/src/utils.lisp
replic/src/completion.lisp
replic/src/config.lisp
replic/src/replic.lisp
replic/src/help.lisp
replic/src/base.lisp
replic/src/utils.lisp
src
(module).
falsy
(function).
format-code
(function).
truthy
(function).
*colorize-output*
(special variable).
*false-list*
(special variable).
*pygments-args*
(special variable).
*pygments-command*
(special variable).
*true-list*
(special variable).
replic/src/completion.lisp
src
(module).
*default-command-completion*
(special variable).
add-command
(function).
add-completion
(function).
add-variable
(function).
add-variables-from
(function).
candidates
(function).
commands
(function).
functions-to-commands
(function).
get-function
(function).
get-symbol
(function).
get-variable
(function).
is-function
(function).
is-variable
(function).
variables
(function).
*args-completions*
(special variable).
*commands*
(special variable).
*packages*
(special variable).
*variables*
(special variable).
assoc-value
(function).
call-function-or-return-list
(function).
get-package
(function).
packages
(function).
to-exclude
(function).
with-rl-completion
(macro).
replic/src/config.lisp
src
(module).
apply-config
(function).
has-option-p
(function).
option
(function).
read-config
(function).
*cfg*
(special variable).
*cfg-file*
(special variable).
*cfg-sources*
(special variable).
*section*
(special variable).
config-files
(function).
get-exported-variables
(function).
has-config-p
(function).
no-earmuffs
(function).
print-options
(function).
read-option
(function).
set-option
(function).
replic/src/replic.lisp
src
(module).
*confirm-exit*
(special variable).
*custom-complete*
(special variable).
*help-postamble*
(special variable).
*help-preamble*
(special variable).
*history*
(special variable).
*prompt*
(special variable).
*prompt-prefix*
(special variable).
*verbose*
(special variable).
*version*
(special variable).
*write-history*
(special variable).
autoprint-results-from
(function).
confirm
(function).
functions-to-commands
(function).
load-init
(function).
main
(function).
print-result
(function).
reload
(function).
repl
(function).
set
(function).
version
(function).
*autoprint-functions*
(special variable).
*colors-functions*
(special variable).
*init-file*
(special variable).
*prompt-exit*
(special variable).
autoprint-results-p
(function).
cleanup-candidate
(function).
complete-args
(function).
complete-from-list
(function).
custom-complete
(function).
format-error
(function).
handle-parser-error
(function).
parse-args
(function).
prompt
(function).
quoted-strings
(function).
replic/src/help.lisp
src
(module).
help
(function).
format-h1
(function).
format-help
(function).
help-all
(function).
help-arg
(function).
help-completion
(function).
Packages are listed by definition order.
replic.completion
common-lisp
.
*default-command-completion*
(special variable).
add-command
(function).
add-completion
(function).
add-variable
(function).
add-variables-from
(function).
candidates
(function).
commands
(function).
functions-to-commands
(function).
get-function
(function).
get-symbol
(function).
get-variable
(function).
is-function
(function).
is-variable
(function).
variables
(function).
*args-completions*
(special variable).
*commands*
(special variable).
*packages*
(special variable).
*variables*
(special variable).
assoc-value
(function).
call-function-or-return-list
(function).
get-package
(function).
packages
(function).
to-exclude
(function).
with-rl-completion
(macro).
replic.utils
common-lisp
.
falsy
(function).
format-code
(function).
truthy
(function).
*colorize-output*
(special variable).
*false-list*
(special variable).
*pygments-args*
(special variable).
*pygments-command*
(special variable).
*true-list*
(special variable).
replic.config
common-lisp
.
apply-config
(function).
has-option-p
(function).
option
(function).
read-config
(function).
*cfg*
(special variable).
*cfg-file*
(special variable).
*cfg-sources*
(special variable).
*section*
(special variable).
config-files
(function).
get-exported-variables
(function).
has-config-p
(function).
no-earmuffs
(function).
print-options
(function).
read-option
(function).
set-option
(function).
replic
common-lisp
.
*confirm-exit*
(special variable).
*custom-complete*
(special variable).
*help-postamble*
(special variable).
*help-preamble*
(special variable).
*history*
(special variable).
*prompt*
(special variable).
*prompt-prefix*
(special variable).
*verbose*
(special variable).
*version*
(special variable).
*write-history*
(special variable).
autoprint-results-from
(function).
confirm
(function).
functions-to-commands
(function).
help
(function).
load-init
(function).
main
(function).
print-result
(function).
reload
(function).
repl
(function).
set
(function).
version
(function).
*autoprint-functions*
(special variable).
*colors-functions*
(special variable).
*init-file*
(special variable).
*prompt-exit*
(special variable).
autoprint-results-p
(function).
cleanup-candidate
(function).
complete-args
(function).
complete-from-list
(function).
custom-complete
(function).
format-error
(function).
format-h1
(function).
format-help
(function).
handle-parser-error
(function).
help-all
(function).
help-arg
(function).
help-completion
(function).
parse-args
(function).
prompt
(function).
quoted-strings
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
If true (the default), ask for confirmation when you try to exit the program (with a C-d). The ‘quit‘ command doesn’t ask for confirmation.
Completion function.
When the cursor is at the beginning of the prompt, the default
function tries to complete a command or a variable (starting with
‘*‘.
Afterwards, it reads how to complete the function/variable arguments from ‘complete-args‘.
A variable, list or function to use to complete all commands that don’t have an associated completion method.
Takes no argument and retuns a list of strings.
Text to display after the list of commands and variables.
Text to display before the list of commands and variables.
If true (the default), read and write the history.
The base prompt, usually the application name. Can contain ansi colours (use cl-ansi-text:green etc). The full prompt is built with (prompt).
A prefix, supposed to change during the application (current directory, venv,...)
If true, print debugging information during the program’s execution.
If true (the default), write the commands in the history.
Define a command.
Specify the package it comes from.
Takes a symbol or a string and stores a lowercase string.
Associate the completion for the given verb. The completion candidates can be:
a) a list of strings
b) a function, returning a list of strings.
(if you’d like to give a symbol to be evaluated as a list... just use a function.
Define a variable (as a string), inside package ‘package‘.
To add all the variables of a given package in a row, see ‘add-variables-from‘.
Set all exported variables of package ‘package‘ to be set-able on the repl.
Might be worth doing this before replic.config:apply-config.
Read the config files and for every variable of this section, get its new value.
Apply the configuration settings for the default package’s variables.
In the config file, variables don’t have lispy earmuffs.
Example .replic.conf:
[default]
confirm-exit: false
Then call:
(replic.config:apply-config)
by default, this reads the ’default’ section and looks for parameters of the REPLIC package.
You could read another section for your app, for instance:
[default]
confirm-exit: true
[my-app]
confirm-exit: false
(replic.config:apply-config "my-app")
Tell replic to automatically print the result of all the functions
of this package (except the ones in the exclude list).
By default, no command use this.
Return the completion candidates (list of strings) for this verb.
‘position’: the position of the argument in the lambda list (is it the first argument of the function ?). Completion choices can vary given the argument.
Return the list of available commands.
Ask confirmation. No input means yes.
Change the prompt string with :prompt. If :show-prompt-p evaluates
to true, skip the prompt and confirm.
Output formatted txt for terminal display. The default is to treat txt as markdown and to output ansi color codes for display in a console. The input format can be changed with ‘:lang‘.
Needs pygments >= 2.2 (sudo pip install -U pygments)
pygmentize:
-l <lexer> one of md, cl, lisp,... see all with -L.
-f <formatter> Set the formatter name. If not given, it will be
guessed from the extension of the output file name. If no output
file is given, the terminal formatter will be used by default.
=> console, console256, html,...
Add exported functions of ‘package‘ to the list of commands to complete,
add exported variables to the list of ‘set‘-able variables.
Ignore the functions given in the ‘:exclude‘ list (names as strings, for example "main").
Return the symbol associated to name (str).
Check if the config object has ‘option‘ in section ‘package/section‘ (the section is inferred from the package name).
Print the help of all available commands. If given an argument, print its documentation. Print the first sentence of each command, or print the full text for a particular command.
Example:
help help
Is this string a registered verb ?
Load ‘~/.replic.lisp‘, or the given file.
The file name must be valid.
To call this function with a valid filename, you can use
(merge-pathnames ".foo.lisp" (user-homedir-pathname))
Note: to load an ini-style config file, use replic.config:apply-config.
Parse command line arguments and start the repl.
Read the configuration file(s) first, apply cli args second.
Return this option’s value (as string).
Print this result. By default, print to standard output.
This function can be overriden by users in the lisp init file.
It will be called when ‘autoprint-results-p’ for a function returns ‘t’.
Quit the application.
Search for the config files, parse the config, and return the config object.
Three locations: in the package root, in ~/config/, in the home.
If no ‘cfg-file‘ argument is given, use the global ‘*cfg-file*‘ (".replic.conf").
Reload the lisp file loaded at startup.
Change a variable or see values.
With no arguments, see what parameters are available. With one argument, see the value of this variable.
With a second argument, set it.
"yes", "true" or "t" and "no", "false" or "nil" denote true and false, respectively.
See base.lisp for what this command takes as completion candidates (in short, all variables).
Return the list of available variables.
Alist to associate a verb (str) to its completion candidates.
List of functions we want to automatically print the result of. No need to create a wrapper specifically for replic that will print their result. Use ‘autoprint-results-from’ :package.
The config read from the config.conf files found, in order: in this project root, ~/.config/replic.conf, in the current directory.
Default name of the config file.
List of files to read the config, in order.
Enable printing text with ansi colors.
Alist of a symbol - its function to colorize text. From cl-ansi-text.
List of commands (strings). See ‘add-command’.
(in the context of a readline app, they are simply the first word of the line the user types.)
List of strings meaning ’false’.
The init file to load at startup, containing any lisp
code to be ‘load‘ed. It exports variables and functions
to be used at the CLI, and how to complete them and
their arguments.
Association of a verb or command and the package it comes from (so than we can call it!).
Default section header of the config file(s) to read parameters from.
List of strings meaning ’true’.
List of variables.
Overwrite the completion canditates for the context of BODY.
Simple wrapper to overwrite the ‘*commands*’ list (a "command" app is the first
word of the line).
Useful for sub-prompts. For example:
(with-rl-completion ((list "History" "Litterature")
(rl:readline :prompt "Choose book shelf: ")
This allows to autocomplete the shelf name in a sub-prompt, for example a book creation form, when the shelves names are normally not in the list of commands of the top-level application
See also ‘autoprint-results-from’.
Remove trailing quotes.
Clean only to match input, the candidate should be returned with its quote.
Completion for arguments.
Select all commands from ‘list’ that start with ‘text’.
Complete a symbol. Return a list of strings for candidates.
‘text’ is the partially entered argument. ‘start’ and ‘end’ are the position on the full ‘line-buffer’ (‘rl:*line-buffer*’).
When the cursor is at the beginning of the prompt, complete from commands.
When ‘text’ starts with ‘*’, complete from variables.
‘line-buffer’: optional argument for direct call in tests.
Example:
(custom-complete "w" 6 t "hello")
could return ("world"), given that we defined a completion function.
Print this message in red on error output.
Write txt with an underline.
Format a line of help (with right justification etc).
If ‘short‘ is t, print only the first paragraph denoted by two newline charaters (for the overview).
Return the package this arg is from.
‘name‘: string designating a symbol, registered with ‘add-command‘ or ‘add-variable‘.
Return nil if either we didn’t find config files or they don’t have any section.
Print the documentation of this command or variable.
Return a list of strings, strings that will be completion candidates.
Return this parameter’s name, without earmuffs (’*’).
;; So the config file can suit non-lispers and lispers (who also shall have a lisp configuration file anyway).
Get a list of uniq package symbols used in the application.
From ‘text’ being the full prompt composed of a ‘command’ and
arguments, return only the arguments, possibly quoted.
lyrics "queens of" "lil sis"
returns a list of two strings.
Return the prompt to display.
Return the quoted strings from ‘text’ (delimited by a quotation mark ").
Interpret the value of this option: t, true or 1 means true, parse integers, etc.
key: an existing variable of the given package, which will be set from the config file.
Get the symbol associated to ‘var‘ in ’package’ and set it.
Jump to: | A C F G H I L M N O P Q R S T V W |
---|
Jump to: | A C F G H I L M N O P Q R S T V W |
---|
Jump to: | *
S |
---|
Jump to: | *
S |
---|
Jump to: | B C F H M P R S U |
---|
Jump to: | B C F H M P R S U |
---|