Skip to content

Conversation

MrJithil
Copy link
Member

@MrJithil MrJithil commented Mar 25, 2024

add .cls command which will be very convinient for clearing the active screen

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. repl Issues and PRs related to the REPL subsystem. labels Mar 25, 2024
@MrJithil MrJithil force-pushed the addClsCommandToRepl branch 3 times, most recently from 2e75463 to afe8eea Compare March 26, 2024 05:34
@cola119
Copy link
Member

cola119 commented Mar 31, 2024

I understand the proposal for a new command, but given the existing ctrl+l to clear the screen, I'm curious about the unique use cases for it. Could you share the specific motivations and scenarios for this addition?

@MrJithil
Copy link
Member Author

MrJithil commented Apr 1, 2024

I understand the proposal for a new command, but given the existing ctrl+l to clear the screen, I'm curious about the unique use cases for it. Could you share the specific motivations and scenarios for this addition?

In most CLI and REPL having a command to clear the screen. People who is more using commands instead of shortcuts will a little hard to clear the screen while using Node.js REPL.
So, I though to provide .cls command to solve the issue.

@cola119 cola119 added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 6, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 6, 2024
@nodejs-github-bot
Copy link
Collaborator

@MrJithil MrJithil added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 24, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 24, 2024
@nodejs-github-bot
Copy link
Collaborator

@MrJithil MrJithil force-pushed the addClsCommandToRepl branch from afe8eea to 1d743e5 Compare July 9, 2024 03:56
@MrJithil MrJithil requested a review from joyeecheung August 9, 2024 13:18
@MrJithil MrJithil requested a review from cola119 August 25, 2024 08:38
Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at this twice at least and I have no strong opinion about adding the additional command.
Maybe it's useful, while it's also not required. I did not see requests for it before, so it's probably not often needed while people might also think about it more with the additional command existing.

Should we just accept this? I guess it won't hurt? @nodejs/repl

Copy link
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I guess it's fine to add it.

@BridgeAR
Copy link
Member

@MrJithil could you please rebase?

@MrJithil
Copy link
Member Author

Sure.

repl: add cls command
`.cls` will clear the current repl screen
@MrJithil
Copy link
Member Author

@BridgeAR Rebased. Thanks.

@MrJithil MrJithil requested a review from BridgeAR September 24, 2025 18:50
Copy link

codecov bot commented Sep 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.45%. Comparing base (4dc19ec) to head (43e1003).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #52206      +/-   ##
==========================================
- Coverage   88.49%   88.45%   -0.04%     
==========================================
  Files         703      703              
  Lines      207529   207545      +16     
  Branches    40011    40008       -3     
==========================================
- Hits       183643   183587      -56     
- Misses      15885    15944      +59     
- Partials     8001     8014      +13     
Files with missing lines Coverage Δ
lib/repl.js 94.31% <100.00%> (+0.04%) ⬆️

... and 38 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

['new Error', 'Promise'].forEach((cmd) => r.write(`${cmd}\n`));
assert.strictEqual(accum.match(clearChar), null);
r.write('.cls\n');
assert.strictEqual(accum.match(clearChar).length > 0, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could use assert.match here and have a concrete expectation for the output.

@BridgeAR BridgeAR added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 28, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 28, 2025
@nodejs-github-bot
Copy link
Collaborator

@dario-piotrowicz
Copy link
Member

Just giving my two cents here 🙂

The command makes sense to me but I'm not a huge fan of the name, all the other commands are not in short form:
Screenshot at 2025-10-05 18-55-08
so .cls here would a bit stick out as a sore thumb in my opinion 😅

I was also not familiar of cls is that a microsoft command/convention?

I also feel like it's very unfortunate that repl has a .clear command which has a completely different meaning...
(and having both .clear and .cls feels a bit messy to me)

mh... would it be possible to, instead of introducing a .cls command to:

  • rename .clear as .reset (as a semver major)
  • later re-introduce .clear to clear the screen?

(or alternatively proceed with .cls for now with the plan of renaming it later on in the way I just mentioned?)
(PS: also if we do want to introduce it now what about maybe introducing it as .clearscreen or something like that?)

Copy link
Member

@jasnell jasnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm generally -1 on this. console.clear() works perfectly well for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. repl Issues and PRs related to the REPL subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants