Open ivan opened 1 year ago
Debugging with
diff --git a/args.js b/args.js
index b1c4a68..0d56244 100644
--- a/args.js
+++ b/args.js
@@ -328,4 +328,5 @@ Object.keys(args).filter(optionName => optionName.includes("-"))
.forEach(optionName => delete args[optionName]);
delete args["$0"];
delete args["_"];
+console.log(args);
module.exports = args;
shows that when --browser-script
comes after --browser-executable-path
, url
goes missing in the arguments, and the URL gets appended to browserScripts
instead:
-url: 'https://www.google.com/',
-browserScripts: [ '/home/at/trash/remove-images.js' ],
+browserScripts: [ '/home/at/trash/remove-images.js', 'https://www.google.com/' ],
Based on https://github.com/yargs/yargs/blob/main/docs/tricks.md#arrays and https://github.com/yargs/yargs/blob/main/docs/api.md#array, it looks like it would be possible to remove all the .array(...)
from args.js
and still get arrays from yargs when an --option
is given twice or more.
The only implementation annoyance there is that --browser-script one.js
results in a string from yargs (not in an array), while --browser-script one.js --browser-script two.js
results in an array with two strings.
This works:
But this fails, exiting silently with status code 0:
I just saw that this was already reported in https://github.com/gildas-lormeau/single-file-cli/issues/8#issuecomment-1233639675 but I wanted to make this more visible, because it can take a while to find the cause.
I first observed this on NixOS / google-chrome-unstable and reproduced it on Debian unstable / chromium: