Skip to content

Customizable subprompt in node:repl module #59401

@edemaine

Description

@edemaine

What is the problem this feature will solve?

#57400 changed the node:repl module's "subprompt" from ... to |. This is arguably good for Node's REPL where the main prompt is one character (>), so it encourages alignment, but bad for other software that relied on the subprompt being 3 characters long. See e.g. DanielXMoore/Civet#1768

What is the feature you are proposing to solve the problem?

I suggest that subprompt can be specified in the options object to node:repl, which lets the subprompt be configured. The default remains "| ".

This will require changing the structure of node:readline (where this subprompt is currently stored), though I'm not sure whether we need a public API there.

What alternatives have you considered?

FWIW, #57400 that changed from ... to | mentioned TODO(puskin94): make this configurable (though the comment has since been removed).

I also tried manually overriding require('node:repl').Interface.prototype.setPrompt and require('node:repl').Interface.prototype.prompt, but this did not seem to work; perhaps a different copy of Interface is getting used by node:repl.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    Status

    Awaiting Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions