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

Don't run empty commands (including comments) #6951

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

Conversation

ageron
Copy link
Contributor

@ageron ageron commented Aug 1, 2024

This PR makes sure the REPL ignores empty commands, including comment-only commands.
This is useful if you want to give yourself some visual space by typing Enter several times.
It's also useful if you want to write some comments for educational purposes.

Before

»                [I just typed Enter here]

Enter an expression to evaluate, or a definition (like x = 1) to use later.

  - ctrl-v + ctrl-j makes a newline
  - :q quits
  - :help shows this text again

» # You can do plenty of things in the Roc REPL,
… # including arithmetic:

Enter an expression to evaluate, or a definition (like x = 1) to use later.

  - ctrl-v + ctrl-j makes a newline
  - :q quits
  - :help shows this text again

» 2 * 3

6 : Num *
» 

After

»

» # You can do plenty of things in the Roc REPL,
… # including arithmetic:

» 2 * 3

6 : Num *

I also replaced line.trim() with line.trim_end(), because the spaces don't hurt, and sometimes you want to keep those spaces for visual purposes, for example:

»         ############
… 2 * 3   # AMAZING! #
…         ############

6 : Num *

@ageron ageron force-pushed the ignore-empty-commands-in-repl branch from 1c4983a to 2cc8790 Compare August 1, 2024 10:06
@ageron
Copy link
Contributor Author

ageron commented Aug 2, 2024

I'm not sure why this PR is failing, it looks like the failure is due to some other change, unrelated to this PR. Wdyt?

@ageron ageron force-pushed the ignore-empty-commands-in-repl branch from ae0e36f to 16957ec Compare August 3, 2024 11:31
Copy link

github-actions bot commented Sep 3, 2024

Thank you for your contribution! Sometimes PRs end up staying open for a long time without activity, which can make the list of open PRs get long and time-consuming to review. To keep things manageable for reviewers, this bot automatically closes PRs that haven’t had activity in 60 days. This PR hasn’t had activity in 30 days, so it will be automatically closed if there is no more activity in the next 30 days. Keep in mind that PRs marked Closed are not deleted, so no matter what, the PR will still be right here in the repo. You can always access it and reopen it anytime you like!

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.

2 participants