Interactive console for Crystal Programming Language.
It's like irb, but for Crystal:
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
Prerequisites:
libreadline6-dev
package).Clone the repo:
git clone https://github.com/crystal-community/icr.git
Switch to repo-directory:
cd icr
Build:
make
Install:
sudo make install
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 users can install ICR from AUR.
Enter
it adds a new instruction, generates a new crystal program, and executes it.puts 10
) and the value returned by the last command.paste
- enables paste modedebug
- toggles debug mode off and on. In debug mode icr will print the code before executing itquit
or exit
- exits current interactive consolereset
- clears out all of the accumulated commands__
- holds the result of the last expression. Example:icr > "5" + "2"
=> "52"
icr > __.to_i - 10
=> 42
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.
To run tests:
make test