icr

Interactive console for Crystal programming language repl
0.2.5 released

ICR - Interactive Crystal Build Status

Interactive console for Crystal Programming Language.

Usage

It's like irb, but for Crystal:

GIF demo

Require local files

You can require local files by relative path (starts with ./):

require "./src/my_cool_lib"

Installation

Prerequisites:

  • It requires crystal to be already installed.
  • Readline (for Debian/Ubuntu install libreadline6-dev package).

Clone the repo:

git clone https://github.com/greyblake/crystal-icr.git

Switch to repo-directory:

cd crystal-icr

Build:

make

And create symlink of ./bin/icr in to direcotory that is listed in your $PATH, e.g.:

sudo ln -s $(realpath ./bin/icr) /usr/bin/icr

(it's necessary only for the first time)

Enjoy!)

How does it work?

  • Every time you press Enter it adds new instruction, generates new crystal program and executes it.
  • The output is split into 2 parts: regular program output (e.g. output from puts 10) and value returned by the last command
  • The regular output is saved, and when you type a new instruction, new program is generated. The saved output is subtracted from the new output, and the difference is printed out. It makes an illusion that only new instructions are executed :)

Development

To run tests:

make test

Contributors

  • greyblake Potapov Sergey - creator, maintainer
icr:
  github: crystal-community/icr
  version: ~> 0.2.5
License MIT
Crystal none

Authors

Dependencies 0

Development Dependencies 0

Last synced .
search fire star recently