Skip to content
Myr

Merge pull request #23 from felixge/long-only-flags-with-values

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

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parents d3deb36, 9e8f3b2 · Browse files · 2 files+14 added−1 removed
This commit

State

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

Trailers

  • Fix: Long-only flags would not take values

Diff stats

2 files+14 added−1 removed

  • tests:+13 added−0 removed
  • other:+1 added−1 removed

2 files+14 added−1 removed

modified:lib/commander.js+1 added-1 removed
43 unmodified lines
44 this.required = ~flags.indexOf('<');45 this.optional = ~flags.indexOf('[');46 this.bool = !~flags.indexOf('-no-');47 flags = flags.split(/[ ,|]+/);48 if (flags.length > 1) this.short = flags.shift();48 if (flags.length > 1 && !/^[[<]/.test(flags[1])) this.short = flags.shift();49 this.long = flags.shift();50 this.description = description;51}52
856 unmodified lines
added:test/test.options.large-only-with-value.js+13 added