Skip to content

Conversation

chqrlie
Copy link
Collaborator

@chqrlie chqrlie commented Apr 6, 2024

  • use . on column 0 as directive prefix
  • use directives object properties for genericity
  • accept non ambiguous directive abbreviations
  • simplify handle_directive and handle_cmd

- use . on column 0 as directive prefix
- use `directives` object properties for genericity
- accept non ambiguous directive abbreviations
- simplify `handle_directive` and `handle_cmd`
Copy link
Contributor

@saghul saghul left a comment

Choose a reason for hiding this comment

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

Left some comments.

I think the first prompt should also be updated from:

QuickJS-ng - Type "\h" for help

to:

QuickJS-ng - Type ".help" for help

std.loadScript(filename);
return true;
}
if (a[0] !== '\\' && a[0] !== '.')
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are switching to dot directives, it feeels weird to get .quit in the docs, for example, but for \quit to also work.

Also, \quit() and \quit123 also work, which is arguably wrong.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree .quit() and \quit123 should be rejected. Will do.

I switched to . directives because they are more readable and that's what node uses, I kept backslash for muscle memory, but I should probably remove it at some point.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

repl.js Outdated
"\\clear clear the terminal\n" +
"\\q exit\n");
var sel = (n) => n ? "*": " ";
std.puts(".help this help\n" +
Copy link
Contributor

Choose a reason for hiding this comment

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

Document load ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, definitely. Will do.

@chqrlie
Copy link
Collaborator Author

chqrlie commented Apr 8, 2024

I think the first prompt should also be updated
from QuickJS-ng - Type "\h" for help
to QuickJS-ng - Type ".help" for help

Yes. Good point.

- reject invalid directive with extra characters
- document ".load"
@chqrlie chqrlie merged commit f62b90d into quickjs-ng:master Apr 8, 2024
@chqrlie chqrlie deleted the repl-directives branch April 8, 2024 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants