edf2csv 0.7.147 → 0.7.165

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -2002,9 +2002,28 @@ function usageMessage(error, argv) {
2002
2002
  if (!ambiguous)
2003
2003
  return asError(raw);
2004
2004
  const flag = ambiguous[1];
2005
- // The value is whatever followed the flag. Read from argv rather than from the message,
2006
- // which does not carry it and if it is not there after all, Node's text is still true.
2007
- const at = argv.indexOf(flag);
2005
+ /*
2006
+ The value is whatever followed the flag. Read from argv rather than from the message,
2007
+ which does not carry it — and if it is not there after all, Node's text is still true.
2008
+
2009
+ The occurrence Node stopped at, which is the first one whose value begins with a dash and
2010
+ not simply the first occurrence of the flag. A flag given twice put the wrong value in the
2011
+ sentence: `--end 1e3 --end -5` was refused with `--end was given "1e3", which begins with
2012
+ a dash`, over a value that does not, advising `--end=1e3` — a rewrite of the half that was
2013
+ already fine, leaving the half that was not exactly as it was. `--channels` is repeatable,
2014
+ so two of them is an ordinary command rather than a mistake, and that is where it reads
2015
+ worst: the message quotes a channel name and calls it a flag.
2016
+ */
2017
+ let at = -1;
2018
+ for (let i = 0; i < argv.length; i++) {
2019
+ if (argv[i] !== flag)
2020
+ continue;
2021
+ const next = argv[i + 1];
2022
+ if (next !== undefined && next.startsWith('-')) {
2023
+ at = i;
2024
+ break;
2025
+ }
2026
+ }
2008
2027
  const value = at >= 0 ? argv[at + 1] : undefined;
2009
2028
  if (value === undefined)
2010
2029
  return asError(raw);