Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpreter: introduce a Prompt type #12288

Merged
merged 5 commits into from
Jul 21, 2022
Merged

Conversation

asterite
Copy link
Member

The Prompt type helps with getting input from STDIN and it also allows for incomplete input to be handled. This was already the case when you did crystal i but not when in pry.

Here I also decided to color the input you write after the fact. This is what Ruby's pry does, and I like it. But let me know if you don't like it! (you can always disable it with --no-color).

Pry actually also colors the output. But for that it just pretty inspects the value with a colorer-pretty-inspector. We can do the same, but in a later PR.

Here's are sample session:

interpreter-prompt

@mdwagner
Copy link
Contributor

Just curious, could this also provide the ability to "up/down-arrow" for previous input?

@asterite
Copy link
Member Author

That's readline: #11340

@straight-shoota straight-shoota added this to the 1.6.0 milestone Jul 20, 2022
@asterite asterite merged commit 92320d4 into master Jul 21, 2022
@asterite asterite deleted the interpreter/repl-improvements branch July 21, 2022 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants