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

Hint to Electron developers? #43

Open
datenreisender opened this issue Jul 4, 2023 · 3 comments
Open

Hint to Electron developers? #43

datenreisender opened this issue Jul 4, 2023 · 3 comments

Comments

@datenreisender
Copy link

README.md contains the example require('minimist')(process.argv.slice(2));.

That, of course, is correct for the many people developing plain node applications.

But on Electron (which is a big platform) developers need to be a bit careful because there it depends on how the app is ran to determine how many arguments to slice off. There (but only there!) something likerequire('minimist')(process.argv.slice(process.defaultApp ? 2 : 1)); would be wise to use.

Should this be mentioned?

@ljharb
Copy link
Member

ljharb commented Jul 4, 2023

That seems like one of those universal things that an electron developer has to know - and usually those aren’t documented anywhere but with electron (in this example)

@datenreisender
Copy link
Author

Ah, one more detail: I switched from yargs to minimist because I didn't need all the bells and whistles of the former. yargs does have this functionality out of the box. This is one of the reasons it lead me to this pitfall (another being that this likely does not happen during the initial development).

I think it is correct that minimist does not do this automatically like yargs, as this really is a special case. I just thought it might be common enough, that you might would like to mention it.

@ljharb
Copy link
Member

ljharb commented Jul 4, 2023

It can't hurt, I suppose - although electron is a pretty uncommon use case overall, I'd expect (it gets 600K downloads a week, this package gets 50M, to put it in perspective).

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

No branches or pull requests

2 participants