Skip to content

REPL special commands need arg validation #52218

@MrJithil

Description

@MrJithil

In the current implementation, the REPL commands such as .save and .load accept a filePath as arguments.

It would greatly improve user experience if we could validate these arguments to prevent attempts to save or load files with empty filenames.

In case the file is an empty string, we should print the error message, show the prompt to the user and return.

ERR_MISSING_ARGS would be a good fit here to frame the message.
Eg: const { message } = new ERR_MISSING_ARGS('file');

String values like 0, false, null, undefined etc are still a valid filenames and good to write some unit tests for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues that are suitable for first-time contributors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions