Skip to content
Myr

allow "-" hyphen as an option argument

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by kawanet · committed by kawanet · parent 46f6628 · Browse files · 2 files+25 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+25 added−2 removed

  • tests:+23 added−0 removed
  • other:+2 added−2 removed

2 files+25 added−2 removed

added:test/test.options.hyphen.js+23 added
modified:index.js+2 added-2 removed
541 unmodified lines
542 // requires arg543 if (option.required) {544 arg = argv[++i];545 if (null == arg) return this.optionMissingArgument(option);546 if ('-' == arg[0]) return this.optionMissingArgument(option, arg);546 if ('-' == arg[0] && '-' != arg) return this.optionMissingArgument(option, arg);547 this.emit(option.name(), arg);548 // optional arg549 } else if (option.optional) {550 arg = argv[i+1];551 if (null == arg || '-' == arg[0]) {551 if (null == arg || ('-' == arg[0] && '-' != arg)) {552 arg = null;553 } else {554 ++i;555 }
576 unmodified lines