-
Notifications
You must be signed in to change notification settings - Fork 30
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
Implement basic REPL commands #38
base: main
Are you sure you want to change the base?
Conversation
List of implemented commands: - `.clear` - clears screen - `.exit` - exits REPL - `.help` - prints help message - `.save` - saves all evaluated commands in the current REPL session to a file
Implement Repl#clear & Repl#close methods.
for (entry in COMMANDS) { | ||
var command = entry[0] | ||
var line = _line.trimStart() | ||
if (command.startsWith(line)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just check equality?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, this is inside completion, I didn't have enough context in the diff. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think .save
should perhaps be auto-magic. (see #70) but otherwise this looks pretty clean.
@vladimyr If the CLI auto-remembered history from the prior sessions would that have prevented you from adding |
I think this has the right idea (of adding some basic editor commands). Ruby, would this be more mergeable if we ripped out |
List of implemented commands:
.clear
- clears screen.exit
- exits REPL.help
- prints help message.save
- saves all evaluated commands in the current REPL session to a file