The replic Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The replic Reference Manual

This is the replic Reference Manual, version 0.11, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Mon Jul 29 16:33:42 2019 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

[[http://quickdocs.org/replic][file:http://quickdocs.org/badge/replic.svg]]

* Replic

Building a  readline application is  cool, but readline gives  you the
basics  and you  must still  build  a REPL  around it:  loop and  read
commands, catch a =C-c=, a =C-d=,  ask confirmation to quit, print the
general help, the help of a command, setup the completion of commands, the
completion of their arguments, load an init file,
colorize output,...  =replic= does this for you.

You can use =replic= as a *ready-to-use executable* or as a *library*.

Using  the executable,  you can  define functions  and variables  in
=~/.replic.lisp=,  give  them  completion  candidates,  and  use  them
straight away on the replic command line.

With the library you can automatically  build a
REPL and turn functions you already have into commands in the readline prompt,
with the process described below.

There are a few examples below, in =src/examples.lisp= and expect more to come.

This  is an  attempt at  generalizing what  I did  several times  with
=cl-readline=.

What this is *not*:

- this  is  not a  Lisp  REPL.  See [[https://github.com/koji-kojiro/cl-repl][cl-repl]]  for  that  (itself not  a
  replacement for Slime ;) )
- this is not a shell. See [[https://github.com/bradleyjensen/shcl][shcl]].

Example applications built on replic:

- [[https://github.com/vindarel/cl-torrents][cl-torrents]]
- [[https://github.com/vindarel/cl-bookshops][cl-bookshops]]


** Installation

You can  [[https://gitlab.com/vindarel/replic/-/jobs][download  the  executable]]  (a 14MB  zipped  download,  a  60Mo
GNU/Linux  x64 self-contained  binary,  instant start-up  !), make  it
executable (=chmod +x replic=) and run it: =./replic=,

or build it yourself.

- the library is on Quicklisp (since the 2019-01-07 dist) and on [[http://ultralisp.org/][Ultralisp]]:

: (ql:quickload :replic)

or clone this repo into =~/quicklisp/local-projects/=,

then build the executable with =make build=.

__Note__: you  need the [[https://github.com/vindarel/cl-readline][cl-readline]]  library from Quicklisp of  end of
may, 2018 (for the read and write history feature). See =make install=
for a quick clone.

Run it:

: replic -h

#+BEGIN_EXPORT ascii
Available options:
  -h, --help               Print this help and exit.
  -q, --quiet              Do not load the init file.
  -l, --load ARG           Load the given file.
#+END_EXPORT

: ./replic

and see the available commands:

: replic > help
: replic > help help

Now add commands in your lisp init file (see next section) or build an
application with it (see the Developer section).


** User: the executable and the init file

Given the example =~/.replic.lisp= below, you can
try =hello = (completion for =hello=) and =goodbye =,
where  can be completed from what was given to =hello=.

#+BEGIN_SRC lisp
(in-package :replic.user)

(defparameter *names* '()
  "List of names (string) given to `hello`. Will be autocompleted by `goodbye`.")

(defun hello (name)
  "Takes only one argument. Adds the given name to the global
  `*names*` variable, used to complete arguments of `goodbye`.
  "
  (format t "hello ~a~&" name)
  (push name *names*))

(defun goodbye (name)
  "Says goodbye to name, where `name` should be completed from what was given to `hello`."
  (format t "goodbye ~a~&" name))

(replic.completion:add-completion "goodbye" (lambda () *names*))

(export '(hello goodbye))
#+END_SRC

Note that only the =export='ed  functions and parameters will be taken
into account.

See more examples in the =src/examples.lisp= file of this repository.



*** Define custom completion for arguments

Write a function or a variable and =export= it.

You can associate a function name with a list of completion candidates (a list
of strings) or a function:

#+BEGIN_SRC lisp
(replic.completion:add-completion "goodbye" (lambda () *names*))
#+END_SRC

When you have many functions that  should complete from the same list,
you can set a default completion function:

#+BEGIN_SRC lisp
(setf replic.completion:*default-command-completion* #'my-function)
#+END_SRC

*** Built-in commands

You get a built-in =help= command that shows the documentation of
functions and variables:

#+BEGIN_SRC text
replic > help

Available commands
==================
help       ... Print the help of all available commands.
reload     ... NIL
set        ... Change a variable, see its value, or see all variables.
quit       --- Quit the application.

Available variables
===================
*verbose*  ... If true, print debugging information during the program execution.
#+END_SRC

Write a preamble and a postamble in =*help-preamble*= and =*help-postamble*=.

You can read the help of a specific command or variable (with completion):

: help help

The   general    =help=   shows    the   first   paragraph    of   the
functions/parameters  docstring, the  =help  =  function is  more
complete and shows all of it.

*** Setting and seeing variables

=set= can be used with zero, one or two arguments:

: set

shows all available variables,

: set *variable*

this prints the value of this variable (use auto-completion),

: set *variable* new-value

and this sets a new value. "yes", "true" and "t" denote true.

We kept the "earmuffs" to denote variables.

*** Configuration file

Replic  reads  an  =init=-like  configuration  file.   It  searches  a
=.replic.conf=  file  under  =~/.config/=   and  at  the  user's  home
directory (=~/.replic.conf=).

These are the default parameters with their default values:

#+BEGIN_SRC text
[default]
confirm-exit = true
verbose = false
prompt = > 
history = true
write-history = true
#+END_SRC

"true", "True" and "t" are truthy and "false", "False" and "nil" are falsy.

It  must  begin with  a  section  name  (=default=) (we  don't  handle
different profiles yet).

They are overriden by command line arguments.


** Developer: using replic as a library with an existing system

=replic= is in Quicklisp (2019-01-07):

: (ql:quickload :replic)

Follow the documentation below, and see example applications on [[https://github.com/vindarel/replic/wiki][the wiki]].

*** Change the prompt

You can change the prompt. It defaults to "> ". It can contain ansi colors.

#+BEGIN_SRC lisp
(setf replic:*prompt* (cl-ansi-text:green "replic > "))
#+END_SRC

You can  add a  prefix to it,  for example one  that changes  with the
state of the application (current directory,...):

#+BEGIN_SRC lisp
(setf replic:*prompt-prefix* (format t "(~a) " "sthg"))
#+END_SRC

and concatenate the two with =(replic:prompt)=.

*** [optional] Load base commands (help, reload, set)

If  you want  to  have  the base  commands  (=help=, =reload=,  =set=,
=quit=), import the base package:

#+BEGIN_SRC lisp
(replic.completion:functions-to-commands :replic.base)
#+END_SRC

*** Create commands from a package's exported functions

This is  the core of the  library.

Create  the commands  you'll  find  at the  readline  prompt from  the
/exported/ functions and variables of a given package:

#+BEGIN_SRC lisp
(replic.completion:functions-to-commands :my-package)
#+END_SRC

To exclude functions, use the =:exclude= list:

#+BEGIN_SRC lisp
(replic.completion:functions-to-commands :my-package :exclude '("main"))
#+END_SRC

For more control, you can create a command from one given function:

#+BEGIN_SRC lisp
(replic.completion:add-command :function :package)
;; add a variable:
(replic.completion:add-variable :*variable* :package)
#+END_SRC

It is generally a  good idea to have a package  for the lisp functions
you'll use at the repl, and another  package for the ones that must be
commands at the readline interface.

*** [optional] Automatically print the result of functions

A lisp function from a library usually returns some result and doesn't
necessarily print it. If you  want =replic= to automatically print it,
ask it like so:

#+BEGIN_SRC lisp
(replic:autoprint-results-from :my-package :exclude '("exclude" "those-functions"))
#+END_SRC

*** Load a config file

=replic= searches  by default  for a  =.replic.conf= (see  above). The
function  =replic.config:apply-config=  takes  as  first  parameter  a
package name (as a symbol):

#+BEGIN_SRC lisp
(replic.config:apply-config :replic)
#+END_SRC

and as an optional second parameter, you can give another file name:

#+BEGIN_SRC lisp
(replic.config:apply-config :torrents ".torrents.conf")
#+END_SRC

The  exported  variables  from  the  package  can  then  be
overriden in the config file. For example, the =:replic= package exports

#+BEGIN_SRC text
  (:export :main
           :confirm
           :repl
           :help
           :set
           :reload
           ;; settings
           :*help-preamble*
           :*help-postamble*
           :*prompt*
           :*prompt-prefix*
           :*confirm-exit*
           :*write-history*
           :*verbose*))
#+END_SRC

so we can configure:

#+BEGIN_SRC text
[default]
write-history = true
verbose = true
prompt = my silly prompt
#+END_SRC

and so on.

/Note: for now, we look only at the "default" section./

*** Start the repl

Start the repl:

: (replic:repl)

That's it. You didn't have to write the REPL.

# For illustration,  this is [[https://github.com/vindarel/cl-torrents/commit/ebc1dba5b168dd8432bff42c52a90e3bc6e19454#diff-1b0d53aa910ad7e1016f52042eb10b53L285][the  code we  saved]] by switching  to replic
# (not counting the extra features).


*** Settings

    Variables that are  exported from a package on the  lisp side will
    be automacitally available  for the config file and  read when the
    application starts up.  The rule is that in the  config file, we don't
    use earmuffs (=*foo*= -> =foo=).  Lispers shall use a lispy config
    file anyway.

    The available variables are:

 - =*verbose*= (bool): if true, print debugging information during the program execution.

 - =*confirm-exit*=   (bool):  if   true   (the   default),  ask   for
   confirmation when a user tries to exit the program with a =C-d= (EOF).

 - =*prompt*= (str):  the readline prompt.  Defaults to simply  => =. Can
   contain ansi colours (use =cl-ansi-text:green= for example).

 - =*confirm-exit*=  (t  or  nil):  if  =t=  (the  default),  ask  for
   confirmation when  the user tries to  exit the command line  with a
   =C-d= (EOF).

 - =*write-history*=  (t or  nil):  if =t=  (the  default), write  the
   commands to the app's history. (this needs =cl-readline= superior
   to may, 2018)

 - =*help-preamble*=: text to display at the beginning of the help.

 - =*help-postamble*=: text to display last.

*** Other helpers

- print colored output from markdown or code with pygments:
  =(format-markdown txt :lang "md")=. It outputs text for a console
  display with ansi colours. Needs [[http://pygments.org][pygments]], or
  does nothing.

** Readline settings

The [[https://tiswww.case.edu/php/chet/readline/readline.html][GNU  Readline]] library provides  settings you might  take advantage
of. We can set the settings in the [[https://tiswww.case.edu/php/chet/readline/readline.html#SEC9][readline init file]] (=~/.inputrc= by
default, obeys the =INPUTRC= environment variable).

For example, you can change the *completion behavior*. This:

: TAB: menu-complete

inserts  the  first completion  candidate,  even  if there  are  many,
instead of showing the list of choices under the prompt.

If you prefer *vi mode*:

: set editing-mode vi

etc. See readline's documentation.

** Dev

This is a  generalization on  =cl-readline=. See  also the  simple [[https://github.com/vindarel/cl-readline-example][cl-readline
example]].  Once you've  built two even basic readline  apps you'll want
to factorize the common parts.

We want to store a list of commands (functions, "verbs") and a list of
variables (the ones to use with "set").  We want to read them from any
Lisp file, hence we need to remember the package they come from. This
mechanism is provided through an interface in =completion.lisp=.

Clone this repo in QL's local projects (=~/quicklisp/local-projects=).

Build the executable:

: make build

*** Develop and test interactively into the console

By starting a swank server in the (real) Lisp repl we can compile code
in our editor  and try instantly in the  terminal, without re-building
the executable. See this [[http://turtleware.eu/posts/cl-charms-crash-course.html][cl-charms  crash course]] for now. Some details
need fixing.


** Changelog
- v0.11 (end of june, 2019)
  - added a declarative way to automatically print a function's result
  - fixed: a quoted string on the readline prompt is now understood as
    one single argument.
** Resources


- [[https://github.com/vindarel/cl-readline][cl-readline]]
- [[https://github.com/vindarel/cl-readline-example][cl-readline-example]]

Learning:

- [[https://github.com/LispCookbook/cl-cookbook][Common Lisp Cookbook]]
- https://github.com/CodyReichert/awesome-cl#learning-and-tutorials

Getting started:

- [[https://lispcookbook.github.io/cl-cookbook/editor-support.html][Common Lisp editors (Emacs, Portacle, Vim, Lem, Atom, Sublime), notebooks, REPLs]]
- https://lispcookbook.github.io/cl-cookbook/getting-started.html


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 replic

Author

vindarel

License

MIT

Description

A framework to build readline applications out of existing code.

Version

0.11

Dependencies
Source

replic.asd (file)

Component

src (module)


Next: , Previous: , Up: Top   [Contents][Index]

3 Modules

Modules are listed depth-first from the system components tree.


Previous: , Up: Modules   [Contents][Index]

3.1 replic/src

Parent

replic (system)

Location

src/

Components

Next: , Previous: , Up: Top   [Contents][Index]

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.1 replic.asd

Location

replic.asd

Systems

replic (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.2 replic/src/utils.lisp

Parent

src (module)

Location

src/utils.lisp

Packages

replic.utils

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.3 replic/src/completion.lisp

Parent

src (module)

Location

src/completion.lisp

Packages

replic.completion

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.4 replic/src/config.lisp

Parent

src (module)

Location

src/config.lisp

Packages

replic.config

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.5 replic/src/replic.lisp

Parent

src (module)

Location

src/replic.lisp

Packages
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.6 replic/src/help.lisp

Parent

src (module)

Location

src/help.lisp

Exported Definitions

help (function)

Internal Definitions

Previous: , Up: Lisp files   [Contents][Index]

4.1.7 replic/src/base.lisp

Parent

src (module)

Location

src/base.lisp

Packages

replic.base

Exported Definitions

quit (function)


Next: , Previous: , Up: Top   [Contents][Index]

5 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

5.1 replic.utils

Source

utils.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.2 replic.completion

Source

completion.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.3 replic.config

Source

config.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.4 replic

Source

replic.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.5 replic.user

Source

replic.lisp (file)

Use List

common-lisp


Previous: , Up: Packages   [Contents][Index]

5.6 replic.base

Source

base.lisp (file)

Use List

common-lisp

Exported Definitions

quit (function)


Next: , Previous: , Up: Top   [Contents][Index]

6 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Special variables

Special Variable: *confirm-exit*

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.

Package

replic

Source

replic.lisp (file)

Special Variable: *custom-complete*

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‘.

Package

replic

Source

replic.lisp (file)

Special Variable: *default-command-completion*

A variable, list or function to use to complete all commands that don’t have an associated completion method.

Package

replic.completion

Source

completion.lisp (file)

Special Variable: *help-postamble*

Text to display after the list of commands and variables.

Package

replic

Source

replic.lisp (file)

Special Variable: *help-preamble*

Text to display before the list of commands and variables.

Package

replic

Source

replic.lisp (file)

Special Variable: *history*

If true (the default), read and write the history.

Package

replic

Source

replic.lisp (file)

Special Variable: *prompt*

The base prompt, usually the application name. Can contain ansi colours (use cl-ansi-text:green etc). The full prompt is built with (prompt).

Package

replic

Source

replic.lisp (file)

Special Variable: *prompt-prefix*

A prefix, supposed to change during the application (current directory, venv,...)

Package

replic

Source

replic.lisp (file)

Special Variable: *verbose*

If true, print debugging information during the program’s execution.

Package

replic

Source

replic.lisp (file)

Special Variable: *version*
Package

replic

Source

replic.lisp (file)

Special Variable: *write-history*

If true (the default), write the commands in the history.

Package

replic

Source

replic.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

6.1.2 Functions

Function: add-command NAME PACKAGE

Define a command.
Specify the package it comes from.
Takes a symbol or a string and stores a lowercase string.

Package

replic.completion

Source

completion.lisp (file)

Function: add-completion VERB LIST-OR-FN

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.

Package

replic.completion

Source

completion.lisp (file)

Function: add-variable IT PACKAGE

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‘.

Package

replic.completion

Source

completion.lisp (file)

Function: add-variables-from PACKAGE &key EXCLUDE

Set all exported variables of package ‘package‘ to be set-able on the repl. Might be worth doing this before replic.config:apply-config.

Package

replic.completion

Source

completion.lisp (file)

Function: apply-config PACKAGE &optional CFG-FILE

Read the config files and for every variable of this package, get its new value. In the config file, variables don’t get lispy earmuffs.

Package

replic.config

Source

config.lisp (file)

Function: autoprint-results VERB
Package

replic

Source

replic.lisp (file)

Function: autoprint-results-from PACKAGE &key EXCLUDE

Tell replic to automatically print the result of all the functions of this package (except the ones in the exclude list).

Package

replic

Source

replic.lisp (file)

Function: candidates VERB

Return the completion candidates (list of strings) for this verb.

Package

replic.completion

Source

completion.lisp (file)

Function: commands ()

Return the list of available commands.

Package

replic.completion

Source

completion.lisp (file)

Function: confirm &key PROMPT SHOW-PROMPT-P

Ask confirmation. No input means yes.
Change the prompt string with :prompt. If :show-prompt-p evaluates to true, skip the prompt and confirm.

Package

replic

Source

replic.lisp (file)

Function: falsy IT
Package

replic.utils

Source

utils.lisp (file)

Function: format-code TXT &key LANG PARAMS STREAM

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,...

Package

replic.utils

Source

utils.lisp (file)

Function: functions-to-commands PACKAGE &key EXCLUDE

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").

Package

replic.completion

Source

completion.lisp (file)

Function: functions-to-commands PACKAGE &key EXCLUDE
Package

replic

Source

replic.lisp (file)

Function: get-function VERB
Package

replic.completion

Source

completion.lisp (file)

Function: get-symbol NAME

Return the symbol associated to name (str).

Package

replic.completion

Source

completion.lisp (file)

Function: get-variable ARG
Package

replic.completion

Source

completion.lisp (file)

Function: has-option-p OPTION &optional SECTION

Check if the config object has ‘option‘ in section ‘package/section‘ (the section is inferred from the package name).

Package

replic.config

Source

config.lisp (file)

Function: help &optional ARG

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

Package

replic

Source

help.lisp (file)

Function: is-function VERB

Is this string a registered verb ?

Package

replic.completion

Source

completion.lisp (file)

Function: is-variable ARG
Package

replic.completion

Source

completion.lisp (file)

Function: load-init &optional FILE

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.

Package

replic

Source

replic.lisp (file)

Function: main ()

Parse command line arguments and start the repl.

Read the configuration file(s) first, apply cli args second.

Package

replic

Source

replic.lisp (file)

Function: option OPTION &key SECTION

Return this option’s value (as string).

Package

replic.config

Source

config.lisp (file)

Function: quit ()

Quit the application.

Package

replic.base

Source

base.lisp (file)

Function: read-config &optional CFG-FILE

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").

Package

replic.config

Source

config.lisp (file)

Function: reload ()

Reload the lisp file loaded at startup.

Package

replic

Source

replic.lisp (file)

Function: repl ()
Package

replic

Source

replic.lisp (file)

Function: set &optional VAR ARG

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).

Package

replic

Source

replic.lisp (file)

Function: truthy IT
Package

replic.utils

Source

utils.lisp (file)

Function: variables ()

Return the list of available variables.

Package

replic.completion

Source

completion.lisp (file)

Function: version ()
Package

replic

Source

replic.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

6.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.1 Special variables

Special Variable: *args-completions*

Alist to associate a verb (str) to its completion candidates.

Package

replic.completion

Source

completion.lisp (file)

Special Variable: *autoprint-functions*

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.

Package

replic

Source

replic.lisp (file)

Special Variable: *cfg*

The config read from the config.conf files found, in order: in this project root, ~/.config/replic.conf, in the current directory.

Package

replic.config

Source

config.lisp (file)

Special Variable: *cfg-file*

Default name of the config file.

Package

replic.config

Source

config.lisp (file)

Special Variable: *cfg-sources*

List of files to read the config, in order.

Package

replic.config

Source

config.lisp (file)

Special Variable: *colorize-output*

Enable printing text with ansi colors.

Package

replic.utils

Source

utils.lisp (file)

Special Variable: *colors-functions*

Alist of a symbol - its function to colorize text. From cl-ansi-text.

Package

replic

Source

replic.lisp (file)

Special Variable: *commands*

List of commands.

Package

replic.completion

Source

completion.lisp (file)

Special Variable: *false-list*

List of strings meaning ’false’.

Package

replic.utils

Source

utils.lisp (file)

Special Variable: *init-file*

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.

Package

replic

Source

replic.lisp (file)

Special Variable: *packages*

Association of a verb or command and the package it comes from (so than we can call it!).

Package

replic.completion

Source

completion.lisp (file)

Special Variable: *prompt-exit*
Package

replic

Source

replic.lisp (file)

Special Variable: *pygments-args*
Package

replic.utils

Source

utils.lisp (file)

Special Variable: *pygments-command*
Package

replic.utils

Source

utils.lisp (file)

Special Variable: *section*

Default section header of the config file(s) to read parameters from.

Package

replic.config

Source

config.lisp (file)

Special Variable: *true-list*

List of strings meaning ’true’.

Package

replic.utils

Source

utils.lisp (file)

Special Variable: *variables*

List of variables.

Package

replic.completion

Source

completion.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

6.2.2 Functions

Function: assoc-value ALIST KEY &key TEST
Package

replic.completion

Source

completion.lisp (file)

Function: common-prefix ITEMS
Package

replic

Source

replic.lisp (file)

Function: complete-args TEXT LINE

Completion for arguments.

Package

replic

Source

replic.lisp (file)

Function: complete-from-list TEXT LIST

Select all commands from ‘list’ that start with ‘text’.

Package

replic

Source

replic.lisp (file)

Function: config-files ()
Package

replic.config

Source

config.lisp (file)

Function: custom-complete TEXT START END &optional LINE-BUFFER

Complete a symbol.

‘text‘ is the partially entered word. start and end are the position on ‘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: as argument for direct call in tests.

Package

replic

Source

replic.lisp (file)

Function: format-error MSG

Print this message in red on error output.

Package

replic

Source

replic.lisp (file)

Function: format-h1 TXT &key STREAM

Write txt with an underline.

Package

replic

Source

help.lisp (file)

Function: format-help NAME FUNCTION-OR-VARIABLE &key SHORT

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).

Package

replic

Source

help.lisp (file)

Function: get-args-strings TEXT COMMAND

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.

Package

replic

Source

replic.lisp (file)

Function: get-exported-variables PACKAGE
Package

replic.config

Source

config.lisp (file)

Function: get-package NAME

Return the package this arg is from.

‘name‘: string designating a symbol, registered with ‘add-command‘ or ‘add-variable‘.

Package

replic.completion

Source

completion.lisp (file)

Function: handle-parser-error C
Package

replic

Source

replic.lisp (file)

Function: has-config-p ()

Return nil if either we didn’t find config files or they don’t have any section.

Package

replic.config

Source

config.lisp (file)

Function: help-all ()

Print all the help.

Package

replic

Source

help.lisp (file)

Function: help-arg ARG

Print the documentation of this command or variable.

Package

replic

Source

help.lisp (file)

Function: help-completion ()

Return a list of strings, strings that will be completion candidates.

Package

replic

Source

help.lisp (file)

Function: no-earmuffs VAR

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).

Package

replic.config

Source

config.lisp (file)

Function: packages ()

Get a list of uniq package symbols used in the application.

Package

replic.completion

Source

completion.lisp (file)

Function: print-options &optional SECTION
Package

replic.config

Source

config.lisp (file)

Function: prompt ()

Return the prompt to display.

Package

replic

Source

replic.lisp (file)

Function: quoted-strings TEXT

Return the quoted strings from ‘text’ (delimited by a quotation mark ").

Package

replic

Source

replic.lisp (file)

Function: read-option KEY PACKAGE

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.

Package

replic.config

Source

config.lisp (file)

Function: reset ()

Reset state. Set all lists to nil. For use in the REPL.

Package

replic.completion

Source

completion.lisp (file)

Function: set-option VAR VAL PACKAGE

Get the symbol associated to ‘var‘ in ’package’ and set it.

Package

replic.config

Source

config.lisp (file)

Function: to-exclude SYMBOL EXCLUDE-LIST
Package

replic.completion

Source

completion.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   M   R  
Index Entry  Section

F
File, Lisp, replic.asd: The replic<dot>asd file
File, Lisp, replic/src/base.lisp: The replic/src/base<dot>lisp file
File, Lisp, replic/src/completion.lisp: The replic/src/completion<dot>lisp file
File, Lisp, replic/src/config.lisp: The replic/src/config<dot>lisp file
File, Lisp, replic/src/help.lisp: The replic/src/help<dot>lisp file
File, Lisp, replic/src/replic.lisp: The replic/src/replic<dot>lisp file
File, Lisp, replic/src/utils.lisp: The replic/src/utils<dot>lisp file

L
Lisp File, replic.asd: The replic<dot>asd file
Lisp File, replic/src/base.lisp: The replic/src/base<dot>lisp file
Lisp File, replic/src/completion.lisp: The replic/src/completion<dot>lisp file
Lisp File, replic/src/config.lisp: The replic/src/config<dot>lisp file
Lisp File, replic/src/help.lisp: The replic/src/help<dot>lisp file
Lisp File, replic/src/replic.lisp: The replic/src/replic<dot>lisp file
Lisp File, replic/src/utils.lisp: The replic/src/utils<dot>lisp file

M
Module, replic/src: The replic/src module

R
replic.asd: The replic<dot>asd file
replic/src: The replic/src module
replic/src/base.lisp: The replic/src/base<dot>lisp file
replic/src/completion.lisp: The replic/src/completion<dot>lisp file
replic/src/config.lisp: The replic/src/config<dot>lisp file
replic/src/help.lisp: The replic/src/help<dot>lisp file
replic/src/replic.lisp: The replic/src/replic<dot>lisp file
replic/src/utils.lisp: The replic/src/utils<dot>lisp file

Jump to:   F   L   M   R  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   A   C   F   G   H   I   L   M   N   O   P   Q   R   S   T   V  
Index Entry  Section

A
add-command: Exported functions
add-completion: Exported functions
add-variable: Exported functions
add-variables-from: Exported functions
apply-config: Exported functions
assoc-value: Internal functions
autoprint-results: Exported functions
autoprint-results-from: Exported functions

C
candidates: Exported functions
commands: Exported functions
common-prefix: Internal functions
complete-args: Internal functions
complete-from-list: Internal functions
config-files: Internal functions
confirm: Exported functions
custom-complete: Internal functions

F
falsy: Exported functions
format-code: Exported functions
format-error: Internal functions
format-h1: Internal functions
format-help: Internal functions
Function, add-command: Exported functions
Function, add-completion: Exported functions
Function, add-variable: Exported functions
Function, add-variables-from: Exported functions
Function, apply-config: Exported functions
Function, assoc-value: Internal functions
Function, autoprint-results: Exported functions
Function, autoprint-results-from: Exported functions
Function, candidates: Exported functions
Function, commands: Exported functions
Function, common-prefix: Internal functions
Function, complete-args: Internal functions
Function, complete-from-list: Internal functions
Function, config-files: Internal functions
Function, confirm: Exported functions
Function, custom-complete: Internal functions
Function, falsy: Exported functions
Function, format-code: Exported functions
Function, format-error: Internal functions
Function, format-h1: Internal functions
Function, format-help: Internal functions
Function, functions-to-commands: Exported functions
Function, functions-to-commands: Exported functions
Function, get-args-strings: Internal functions
Function, get-exported-variables: Internal functions
Function, get-function: Exported functions
Function, get-package: Internal functions
Function, get-symbol: Exported functions
Function, get-variable: Exported functions
Function, handle-parser-error: Internal functions
Function, has-config-p: Internal functions
Function, has-option-p: Exported functions
Function, help: Exported functions
Function, help-all: Internal functions
Function, help-arg: Internal functions
Function, help-completion: Internal functions
Function, is-function: Exported functions
Function, is-variable: Exported functions
Function, load-init: Exported functions
Function, main: Exported functions
Function, no-earmuffs: Internal functions
Function, option: Exported functions
Function, packages: Internal functions
Function, print-options: Internal functions
Function, prompt: Internal functions
Function, quit: Exported functions
Function, quoted-strings: Internal functions
Function, read-config: Exported functions
Function, read-option: Internal functions
Function, reload: Exported functions
Function, repl: Exported functions
Function, reset: Internal functions
Function, set: Exported functions
Function, set-option: Internal functions
Function, to-exclude: Internal functions
Function, truthy: Exported functions
Function, variables: Exported functions
Function, version: Exported functions
functions-to-commands: Exported functions
functions-to-commands: Exported functions

G
get-args-strings: Internal functions
get-exported-variables: Internal functions
get-function: Exported functions
get-package: Internal functions
get-symbol: Exported functions
get-variable: Exported functions

H
handle-parser-error: Internal functions
has-config-p: Internal functions
has-option-p: Exported functions
help: Exported functions
help-all: Internal functions
help-arg: Internal functions
help-completion: Internal functions

I
is-function: Exported functions
is-variable: Exported functions

L
load-init: Exported functions

M
main: Exported functions

N
no-earmuffs: Internal functions

O
option: Exported functions

P
packages: Internal functions
print-options: Internal functions
prompt: Internal functions

Q
quit: Exported functions
quoted-strings: Internal functions

R
read-config: Exported functions
read-option: Internal functions
reload: Exported functions
repl: Exported functions
reset: Internal functions

S
set: Exported functions
set-option: Internal functions

T
to-exclude: Internal functions
truthy: Exported functions

V
variables: Exported functions
version: Exported functions

Jump to:   A   C   F   G   H   I   L   M   N   O   P   Q   R   S   T   V  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*args-completions*: Internal special variables
*autoprint-functions*: Internal special variables
*cfg*: Internal special variables
*cfg-file*: Internal special variables
*cfg-sources*: Internal special variables
*colorize-output*: Internal special variables
*colors-functions*: Internal special variables
*commands*: Internal special variables
*confirm-exit*: Exported special variables
*custom-complete*: Exported special variables
*default-command-completion*: Exported special variables
*false-list*: Internal special variables
*help-postamble*: Exported special variables
*help-preamble*: Exported special variables
*history*: Exported special variables
*init-file*: Internal special variables
*packages*: Internal special variables
*prompt*: Exported special variables
*prompt-exit*: Internal special variables
*prompt-prefix*: Exported special variables
*pygments-args*: Internal special variables
*pygments-command*: Internal special variables
*section*: Internal special variables
*true-list*: Internal special variables
*variables*: Internal special variables
*verbose*: Exported special variables
*version*: Exported special variables
*write-history*: Exported special variables

S
Special Variable, *args-completions*: Internal special variables
Special Variable, *autoprint-functions*: Internal special variables
Special Variable, *cfg*: Internal special variables
Special Variable, *cfg-file*: Internal special variables
Special Variable, *cfg-sources*: Internal special variables
Special Variable, *colorize-output*: Internal special variables
Special Variable, *colors-functions*: Internal special variables
Special Variable, *commands*: Internal special variables
Special Variable, *confirm-exit*: Exported special variables
Special Variable, *custom-complete*: Exported special variables
Special Variable, *default-command-completion*: Exported special variables
Special Variable, *false-list*: Internal special variables
Special Variable, *help-postamble*: Exported special variables
Special Variable, *help-preamble*: Exported special variables
Special Variable, *history*: Exported special variables
Special Variable, *init-file*: Internal special variables
Special Variable, *packages*: Internal special variables
Special Variable, *prompt*: Exported special variables
Special Variable, *prompt-exit*: Internal special variables
Special Variable, *prompt-prefix*: Exported special variables
Special Variable, *pygments-args*: Internal special variables
Special Variable, *pygments-command*: Internal special variables
Special Variable, *section*: Internal special variables
Special Variable, *true-list*: Internal special variables
Special Variable, *variables*: Internal special variables
Special Variable, *verbose*: Exported special variables
Special Variable, *version*: Exported special variables
Special Variable, *write-history*: Exported special variables

Jump to:   *  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   P   R   S  
Index Entry  Section

P
Package, replic: The replic package
Package, replic.base: The replic<dot>base package
Package, replic.completion: The replic<dot>completion package
Package, replic.config: The replic<dot>config package
Package, replic.user: The replic<dot>user package
Package, replic.utils: The replic<dot>utils package

R
replic: The replic system
replic: The replic package
replic.base: The replic<dot>base package
replic.completion: The replic<dot>completion package
replic.config: The replic<dot>config package
replic.user: The replic<dot>user package
replic.utils: The replic<dot>utils package

S
System, replic: The replic system

Jump to:   P   R   S