icr v0.6.0

Interactive console for Crystal programming language

Releases:

  • v0.6.0 - November 4, 2018
  • v0.5.0 - January 1, 2018
  • v0.4.0 - November 14, 2017
  • v0.3.0 - October 21, 2017

Dependencies:

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"

Libs can also be required from the cli:

$ icr -r colorize -r ./src/my_cool_lib

Installation

Prerequisites:

  • The latest version of crystal.
  • Readline (for Debian/Ubuntu install libreadline6-dev package).
  • LLVM development files.

Clone the repo:

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

Switch to repo-directory:

cd icr

Build:

make

Install:

sudo make install

As a shard dependency

If you would like to include icr as a dependency, you can add it to your shard.yml

dependencies:
  icr:
    github: crystal-community/icr
    branch: master

Then just run shards install from your project!

Enjoy!

Arch Linux

Arch Linux users can install ICR from AUR.

How does it work?

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

Commands and special locals

  • paste - enables paste mode
  • debug - toggles debug mode off and on. In debug mode icr will print the code before executing it
  • quit or exit - exits current interactive console
  • reset - clears out all of the accumulated commands
  • __ - holds the result of the last expression. Example:
icr > "5" + "2"
=> "52"
icr > __.to_i - 10
=> 42

Update check

ICR periodically checks for the new releases on Github. If your current version is out of date, it will simply show you a notice at start.

You can disable this behavior using --disable-update-check CLI flag.

Development

To run tests:

make test

Editor integration

  • inf-crystal.el - Connects REPL buffer to the ICR subprocess in Emacs

Contributors

  • greyblake Potapov Sergey - creator, maintainer
  • BlaXpirit Oleh Prypin - fixes for Crystal 0.16
  • puppetpies Brian Hood - support of records
  • jwoertink Jeremy Woertink - support of -r option and number of other contributions
  • veelenga V. Elenhaupt - maintenance
  • MakeNowJust TSUYUSATO Kitsune - syntax highlight support

v0.6.0 2018-11-04

  • Crystal 0.27 compatibility (#102 thanks to @blazerw)

v0.5.0 2018-01-01

  • New debug command to toggle debug output interactively (#74, thanks to @russolsen)
  • New reset command to clear commands (#75, thanks to @russolsen)
  • Crystal 0.24.1 support (#72, thanks to @veelenga)
  • Corrected Icr::HOMEPAGE (#81, thanks to @Sija)

v0.4.0 2017-11-14

  • Add syntax highlight (MakeNowJust) #70
  • README grammar fixes (Sevensidedmarble) #73
  • Remove post-install scripts (faustinoaq) #69
  • Change suggestion for binary location (coderhs) #68

v0.3.0 2017-10-21

  • Add slightly better support for macros (jwoertink) #47
  • Add --no-debug flag to improve speed (faustinoaq) #52
  • Implementation of the paste mode (Porcupine96) #56
  • Catch constant assignment and set it outside of the exec method (jwoertink) #59
  • Last result local '__' (veelenga) #63
  • Fixed error with unterminated char literal (jwoertink) #50
  • Usage warning (veelenga) #66

v0.2.14 2017-01-31

  • (fix) behavioral difference when reassigning variable in multi-line blocks (jwoertink)

v0.2.13 2016-11-25

  • Update for Crystal 0.20 compatibility (jwoertink)

v0.2.12 2016-11-16

  • Support alias (jwoertink)

v0.2.11 2016-11-10

  • Handle multi line hash (jwoertink)

v0.2.10 2016-09-09

  • Support of -r option (jwoertink)

v0.2.9 2016-09-07

  • Support of records (puppetpies)
  • Support of Crystal 0.19

v0.2.8 2016-05-23

  • Support of Crystal 0.16 (BlaXpirit)

v0.2.7 2016-03-23

  • Support of Crystal 0.14

v0.2.6 2016-03-22

  • (fix) allow assignment with operator (issue 12)

v0.2.5 2016-03-21

  • (fix) remove .crystal tmp dir (issue 14)
  • Add LGPL license (issue 13)

v0.2.4 2016-02-17

  • (fix) display stderr output

v0.2.4 2016-02-17

  • (fix) display stderr output

v0.2.3 2016-02-07

  • Remove LLVM dependency (fixes LLVM issue)

v0.2.2 2016-01-30

  • Support of --help and --version options
  • Support of debug mode (--debug option)

v0.2.1 2016-01-30

  • Ability to require local files

v0.2.0 2016-01-30

  • Support multiline input
  • Support definition of modules, classes and methods
  • Return just "OK", when file is required
  • Exit with proper message, if crystal is not installed
  • Proper integration tests
  • Refactor

v0.1.2 2016-01-25

  • Exit with Ctrl+D (thanks Baptiste Fontaine)
  • Handle empty inputs

v0.1.1 2016-01-24

  • Support crystal 0.11.0

v0.1.0 2016-01-22

  • First public release
Github statistic:
  • 346
  • 33
  • 13
  • 10
  • 4 days ago

License:

MIT License

Links: