| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
- detect REPL - detect bundled Electron app - otherwise process.argv.slice(2)
|
Just spotted node -p in a comment. I had a feeling I was missing another special mode! |
Sorry, something went wrong.
|
node -pe is critical |
Sorry, something went wrong.
|
Added -p and --print. e.g. % node --print 'require (".").parseArgs()' first second
{ args: {}, values: {}, positionals: [ 'first', 'second' ] }
|
Sorry, something went wrong.
|
Added tests, refactored code to be an explicit placeholder for process.mainArgs, describe Election as an example rather than as intended for inclusion. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Problem
We are proposing to determine appropriate default arguments for node --eval, Electron, and ES6.
Using require.main to determine --eval (or REPL) gives false positive for ES6 main program.
Related: #5 #18
Solution
Implement a placeholder for process.mainArgs that covers the scenarios that have been raised.
Related PRs for Electron argument processing:
And for historical interest, the addition of defaultApp in Electron to work-around the variant behaviour:
Example
% node es6.mjs --foo 1 2 3 { args: { foo: true }, values: { foo: [ undefined ] }, positionals: [ '1', '2', '3' ] }