https://github.com/vindarel/cl-readline-example
Using readline in Common Lisp.
https://github.com/vindarel/cl-readline-example
common-lisp
Last synced: 3 months ago
JSON representation
Using readline in Common Lisp.
- Host: GitHub
- URL: https://github.com/vindarel/cl-readline-example
- Owner: vindarel
- Created: 2018-01-11T01:55:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-11-08T18:09:06.000Z (over 1 year ago)
- Last Synced: 2025-02-12T04:17:37.538Z (4 months ago)
- Topics: common-lisp
- Language: Common Lisp
- Size: 15.6 KB
- Stars: 12
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Readline example in Common Lisp
Example from cl-readline's documentation: https://vindarel.github.io/cl-readline/
It showcases custom completion and keybindings. Type a command (with TAB-completion), and type arguments (with TAB-completion of the choices).
To run the example:
sbcl --script example.lisp
or build an executable:
make build # and then ./clreadline
(we added handling of a `C-c`).
See the `custom completion`: first, type and complete a verb (`eat`, `throw`,…). Later words are completed as fruits (`orange`, `banana`,…). Type "o" and see the completion to "orange" (no dropdown list).

Also type `C-o` to insert a predefined custom text,
and type an opening paren "(" to insert two parens and move the cursor in-between (using `rl:insert-text` and `rl:backward-char`).
Some command line apps using cl-readline:
* [cl-repl](https://github.com/koji-kojiro/cl-repl) - an SBCL repl.
* [cl-torrents](https://github.com/vindarel/cl-torrents) - searching and downloading torrents from popular trackers.
* [replic](https://github.com/vindarel/replic/) - a library to quickly build a readline app from a lisp library.
* [sbcli](https://github.com/hellerve/sbcli/) - a simple wrapper around the bare-bones SBCL REPL with completion of Lisp symbols, syntax highlighting, no interactive debugger by default.
* [cl-repl](https://github.com/koji-kojiro/cl-repl/) - an advanced terminal Lisp REPL for the terminal: interactive debugger, syntax highlighting, code editing with a text editor…
* [OpenBookStore](https://github.com/OpenBookStore/openbookstore) - a book management software, with web and readline interfaces.
* [shtookovina](https://github.com/mrkkrp/shtookovina/) - a language learning app (unmaintained).Please add yours here and/or in [readline's wiki](https://github.com/vindarel/cl-readline/wiki)!
## Changelog
We added:
* Nov, 2023: bind "(" to "( )" and move the cursor in-between.
* Nov, 2022: handle a C-d (NIL input), output something to show using the text variable.
* july, 2019: rewrote without curry, removed the dependency on Alexandria, added a dependency on cl-str.
* asdf system declaration
* `make build` to build a binary
* catch a `C-c` (and others) and quit gracefully (in executable only).