Skip to content

repl: extract and standardize history from both repl and interface#58225

Merged
nodejs-github-bot merged 1 commit intonodejs:mainfrom
puskin:repl-extract-history
May 28, 2025
Merged

repl: extract and standardize history from both repl and interface#58225
nodejs-github-bot merged 1 commit intonodejs:mainfrom
puskin:repl-extract-history

Conversation

@puskin
Copy link
Contributor

@puskin puskin commented May 8, 2025

Refactored and decoupled the history logic into its own separate module and made both REPL and readline depend on it as little as possible, still not breaking functionality.

Updated the repl.setupHistory function to accept more parameters than just a string for the history file path and a callback. Before this change you had to manually update the REPL instance to accept history parameters. With the decoupling of this PR, you can now achieve the same result calling the updated method:

repl.setupHistory({
    filePath: './path/to/history/file',
    size: 50,
    removeHistoryDuplicates: true,
    onHistoryFileLoaded: callback,
  });

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

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. needs-ci PRs that need a full CI run. readline Issues and PRs related to the built-in readline module. repl Issues and PRs related to the REPL subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants