-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
feat(readline): add skipHistory option to rl.question() to exclude input from history #59450
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
base: main
Are you sure you want to change the base?
feat(readline): add skipHistory option to rl.question() to exclude input from history #59450
Conversation
This comment was marked as spam.
This comment was marked as spam.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #59450 +/- ##
==========================================
- Coverage 89.87% 89.85% -0.02%
==========================================
Files 656 656
Lines 192956 192976 +20
Branches 37844 37847 +3
==========================================
- Hits 173410 173399 -11
- Misses 12101 12114 +13
- Partials 7445 7463 +18
🚀 New features to boost your workflow:
|
BridgeAR
left a comment
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 having such functionality makes sense.
I just wonder if we should ever save the response in the history or, if it would be best to ignore it by default. Has this ever been discussed anywhere? I couldn't find anything around that.
I'm a newcomer in this ecosystem. Saw this as an open issue so tried to do something. Issue is listed here. |
Add a boolean skipHistory option to readline.Interface.question(). When true, the input will not be saved in the readline history. Useful for sensitive inputs like passwords. Includes tests verifying both skipHistory enabled and disabled cases. Docs to be added later after maintainer review. Fixes: nodejs#59390
- Added common.mustCall to ensure callbacks are invoked as expected - Used assert.partialDeepStrictEqual to verify rl.history contents precisely
- Capitalized comments per style guide - Added missing trailing commas in objects - Use primordials.Symbol instead of global Symbol - Address node-core linting rules for internal modules
- Capitalized comments per style guide - Added missing trailing commas in objects - Use primordials.Symbol instead of global Symbol - Address node-core linting rules for internal modules
- Address node-core linting rules for internal modules - test case for skipHistory false
ac13bf9 to
11c50c9
Compare
|
We would want to document the new option if that's the approach we decide to go with. |
I can update the documentation as per the guidelines once we decide about the requirements. Will keep this as open until then. If someone could finalise about the requirements it will be easy to continue. |
|
Let's just change the current implementation and release it as breaking change. I believe it was just an oversight to include these entries in the history originally. No one has likely thought about that. |
Sorry I missed your reply. So what you recommend
|
|
Hi @nodejs/tsc @nodejs/collaborators, Hope you're all doing well! I wanted to gently follow up on my PR. |
Description
This PR adds a new
skipHistoryboolean option to thereadline.Interface.question()method.When set to
true, the user input is excluded from the readline history, useful for sensitive inputs such as passwords.Implements the skipHistory flag throughout the readline and repl internals.
Testing
test-readline-skip-history.jsverifying correct behavior.Documentation
Documentation for the skipHistory option will be added in a follow-up PR or upon maintainer guidance.
Example usage
Fixes: #59390