Giter Site home page Giter Site logo

sbcli's Introduction

sbcli

A better REPL for SBCL. It handles errors gracefully, is not too verbose, has readline capabilities, including multiline input and reset, and has optional syntax highlighting capabilities using pygmentize.

Installation

For most cases, calling ./install.sh should suffice. It will install sbcli into $PREFIX/bin, with the environment variable PREFIX defaulting to /usr/local. If you are using Mac and having issues with cl-readline see the installation notes for cl-readline.

Dependencies

sbcli depends on [alexandria(https://common-lisp.net/project/alexandria/], cl-str and cl-readline. If you have Quicklisp installed, all the dependencies will be installed on sbclis first launch. sbcli assumes that Quicklisp is installed under ~/quicklisp.

Usage

You should be able to launch sbcli by just typing sbcli. Once you’re in the REPL, you can edit normally with readline capabilities. Hitting tab will autocomplete (note that if there is more than one possibility, you’ll have to hit tab twice).

Typing :help will give you an overview over all the available special cases and give you an overview over what you’ve defined.

Typing :h symbol will enter inspection mode for a symbol. Typing CTRL-D exits inspection mode.

Typing :doc symbol prints the available documentation for this symbol.

Typing (symbol ? also prints the available documentation for this symbol.

Typing :q, CTRL-D, or CTRL-C will exit the REPL.

Typing :r resets the environment.

Typing :d symbol dumps the disassembly of a symbol.

Typing :t <expression> prints the type returned by an expression.

Typing :s filename will save all of the expressions that were typed and evaluated to the file specified, in the format:

(+ 1 2) ; => 3
(* 6 10) ; => 60

Of course, depending on your result, this can result in very long lines, or break if your result contains newlines. Use at your own peril for now!

Customization

If you want you can add customizations to sbcli. On startup it will load a file called .sbclirc in your home directory if it exists. You can execute arbitrary code there, two of the more interesting values to set are *prompt* and *ret*. Check out an example resource file here.

Exposed Variables

For reference, here is a complete list of the variables we expose:

; the name of the REPL, printed on top
*repl-name*    ; => "Veit's REPL for SBCL"

; the prompt and continuation prompt variables
*prompt*       ; => "sbcl> "
*prompt2*      ; => "....> "

; the return value prompt
*ret*          ; => "=> "

; where to store the history
*hist-file*    ; => "~/.sbcli_history"

; the history variable
; while nothing prevents you from writing to it, i advise against it
*hist*         ; => ()

; you can optionally set a path to pygmentize to enable syntax-coloring
; in the REPL. N.B: might lead to slower rendering speed
;
; if you're unsure what to put there, i suggest using
; [which](https://github.com/eudoxia0/which)
*pygmentize* ; => nil
; you can also customize the pygmentize invocation
*pygmentize-options* ; => ("-s" "-l" "lisp")

; the last error encountered in the REPL. You can call
; `invoke-debugger` on it!
*error*

Have fun!

sbcli's People

Contributors

hellerve avatar janfel avatar jgarte avatar lucasew avatar parjanya avatar sudodoki avatar vindarel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

sbcli's Issues

pygmentize has problems

Hi @hellerve.

I'm trying to use pygmentize.

It output the help on the prompt and don't let use the CLI:

❯ sbcli
My LISP REPL version 0.1.3
Press CTRL-D or type :q to exit

> Usage: /home/max/.local/bin/pygmentize [-l <lexer> | -g] [-F <filter>[:<options>]] [-f <formatter>]

I'm on Linux with Python 3.8 and last Pygments version

Color themes for pygmentize?

I feel spoiled asking this, but my what I immediately realize when starting using sbcli with pygmentize, which sounded great, is that the contrast is really too low to be usable. I have a dark pastel theme in my terminal. I have never directly used pygmentize before testing sbcli, but I have now just tried to pygmentize a Python file to standard out, and it really looks horrible. I do not really want to spend more time on this right now (I want to spend time reading my Lisp book instead) but if you have any tips on getting a different color theme with sbcli and pygmentize, I'm all ears.

Otherwise, sbcli seems really neat. Thanks for sharing it.

Interaction with the debugger

Thanks for writing this wonderful thing!

I wonder if it's possible to interact with the debugger as in the usual sbcl. For now, by default, it seems that whenever an error (or a condition) occurs, sbcli prints the message to screen but does not let us choose what to do (e.g. ignore, accept, abort.. etc).

utils.lisp location

At least here (load "utils.lisp") makes invoking sbcli only work inside its own directory; where should it go instead? to /usr/local/bin/ too? or just put its content inside repl.lisp?

SB-KERNEL:SIMPLE-PACKAGE-ERROR when invoking `:r`

The following interactive session says it all:

$ sbcli
Veit's REPL for SBCL version 0.1.4
Press CTRL-D or type :q to exit

sbcl> :help
Veit's REPL for SBCL version 0.1.4
Special commands:
  :h: Gets help on a symbol <sym>
  :help: Prints a general help message
  :doc: Print the available documentation for this symbol.
  :s: Writes the current session to a file <filename>
  :d: Dumps the disassembly of a symbol <sym>
  :t: Prints the type of a expression <expr>
  :q: Ends the session
  :r: Resets the session environment
Currently defined:
sbcl> :r

debugger invoked on a SB-KERNEL:SIMPLE-PACKAGE-ERROR in thread
#<THREAD "main thread" RUNNING {10046101B3}>:
  Package "SBCLI" is used by package:("SBCLI-USER")

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [CONTINUE] Remove dependency in other packages.
  1: [RETRY   ] Retry EVAL of current toplevel form.
  2:            Ignore error and continue loading file "/usr/local/bin/sbcli".
  3: [ABORT   ] Abort loading file "/usr/local/bin/sbcli".
  4:            Abort script, exiting lisp.

(DELETE-PACKAGE SBCLI)
0] 3

Am I missing something obvious?

ASD file

Hi, thanks for making this project!

Would you accept a .asd file for this project?

Resolving this would also make it very easy to package sbcli for GNU Guix.

@vindarel I think that this issue might be related to #17

Any particular mission statement / roadmap for this project?

Hello!
Thanks for sharing this project, it's quite fun. Wondering, whether you have some specific use cases that this project covers the best or maybe, some vision/idea of what it should be?
Previously, I would be using rlwrap sbcl for some repl experiments. As I see now, thigs that sbcli is doing better (compared to rlwrap sbcl):

  1. easier to customize prompt
  2. using cl-readline means that it's possible to hook into completion via (rl:register-function :complete #'complete) and do autocomplete (which is missing from rlwrap sbcl combo, or I wasn't able to set it up)

doing worse:

  1. no multiline input / paste
  2. no restarts

Better completion with packages

Hello,

Currently typing package:sym will not complete "sym" from "package".

I see that cl-repl does that correctly.

I'm on it, rounding up edge cases.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.