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

Implement basic REPL commands #38

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

vladimyr
Copy link
Contributor

@vladimyr vladimyr commented Jun 7, 2020

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

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.
@ruby0x1 ruby0x1 closed this Jun 12, 2020
@ruby0x1 ruby0x1 reopened this Jun 13, 2020
@ruby0x1 ruby0x1 changed the base branch from master to main June 13, 2020 21:25
for (entry in COMMANDS) {
var command = entry[0]
var line = _line.trimStart()
if (command.startsWith(line)) {
Copy link
Contributor

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?

Copy link
Contributor

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. :)

Copy link
Contributor

@joshgoebel joshgoebel left a 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.

@joshgoebel
Copy link
Contributor

@vladimyr If the CLI auto-remembered history from the prior sessions would that have prevented you from adding save here?

@joshgoebel
Copy link
Contributor

I think this has the right idea (of adding some basic editor commands). Ruby, would this be more mergeable if we ripped out save for short-term and focused on the simpler commands and then made a separate PR for both save & load? It seems the pair should go together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants