reply
Version, currently 0.1.06 versions
github.com/I3oris/reply
Shard to create a REPL interface
25 stars
3 dependents
License: MIT
Nothing has been indexed for 0.1.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
reply:
github: I3oris/reply
version: ~> 0.1.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.1.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
# REPLy
REPLy is a shard that provide a term reader for a REPL (Read Eval Print Loop).
## Features
It includes the following features:
* Multiline input
* History
* Pasting of large expressions
* Hook for Syntax highlighting
* Hook for Auto formatting
* Hook for Auto indentation
* Hook for Auto completion (Experimental)
* History Reverse i-search
* Commands with do_methods
* Work on Windows 10
It doesn't support yet:
* Customizable hotkeys
* Unicode characters
NOTE: REPLy was extracted from https://github.com/I3oris/ic, it was first designed to fit exactly the usecase of a crystal interpreter, so don't hesitate to open an issue to make REPLy more generic and suitable for your project if needed.
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
reply:
github: I3oris/reply
```
2. Run `shards install`
## Usage
### Minimal example
```crystal
require "reply"
reader = Reply::Reader.new
reader.read_loop do |expression|
# Eval expression here
puts " => #{expression}"
end
```
### Customize the interface
```crystal
require "reply"
class MyReader < Reply::Reader
def prompt(io : IO, line_number : Int32, color : Bool) : Nil
# Display a custom prompt
end
def highlight(expression : String) : String
# Highlight the expression
end
def continue?(expression : String) : Bool
# Return whether the interface should continue on multiline, depending of the expression
end
def format(expression : String) : String?
# Reformat when expression is submitted
end
def indentation_level(expression_before_cursor : String) : Int32?
# Compute the indentation from the expression
end
def save_in_history?(expression : String) : Bool
# Return whether the expression is saved in history
end
def auto_complete(name_filter : String, expression : String) : {String, Array(String)}
# Return the auto-completion result from expression
end
end
```
### Add commands to your REPL
```crystal
require "reply"
class MyReader < Reply::Reader
include Commands
# Method starting with 'do_' will add a command.
def do_custom_command(arg1 : String, arg2 = nil)
puts "Executing command 'custom_command' with arguments: #{arg1} #{arg2}"
end
end
reader = Reply::Reader.new
reader.run_commands_loop
# Test with:
# $:010>custom_command foo
```
> See [examples/command_repl.cr](examples/command_relp.cr) for more details.
## Similar projects
* [fancyline](https://github.com/Papierkorb/fancyline)
* [crystal-readline](https://github.com/crystal-lang/crystal-readline)
## Development
Free to pull request!
## Contributing
1. Fork it (<https://github.com/I3oris/reply/fork>)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
## Contributors
- [I3oris](https://github.com/I3oris) - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.1.0- Tagged
- Aug 11, 2026
- Commit
f0e7ae62e661- Indexed
- not yet
Dependents
Repository
github.com/I3oris/reply
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 6