Skip to content
Myr

Added support for long flags only. Closes #18

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

.option("--whatever", "some stuff")

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 81ec7aa · Browse files · 2 files+15 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+15 added−2 removed

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

2 files+15 added−2 removed

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