Skip to content
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

Improve command line interface #179

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Rob23oba
Copy link
Contributor

Re-writes the command line parser (prefs.js) and adds a more helpful help message. Prefs is also renamed to Options, mostly so that I could make sure that nobody was using Prefs anymore. The help message is currently very unorganized and many options that should be invisible by default aren't - however this is easy to fix by shuffling around a few elements and adding a few hide: trues and a few { separator: '...' }s.

help: 1
},
{
arg: 'help-hidden',
Copy link
Contributor

Choose a reason for hiding this comment

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

--help-verbose maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, also a good idea.


for (const x of process.argv) {
if (x[0] !== '-') continue;
export function parseArgs(argv, optionsOnly = false, file) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Usually Porffor uses the export const parseArgs = (...) => ... format, not function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I guess a simple change.

runner/repl.js Outdated
globalThis.valtype = Options.valtype ?? 'f64';

const color = (txt, colors) => {
if (!(process.stdout.isTTY ?? true)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this require changes to index.html's setProcess method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I have a better version in prefs.js but I don't think repl gets used within the website?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, you're right, I misread which file this was in.

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