Skip to content
Myr

docs

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 · parent 2a175d7 · Browse files · 2 files+9 added−9 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+9 added−9 removed

  • other:+9 added−9 removed

2 files+9 added−9 removed

modified:lib/commander.js+8 added-8 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 this.small = flags.shift();49 this.large = flags.shift();48 this.short = flags.shift();49 this.long = flags.shift();50 this.description = description;51}5253/**
3 unmodified lines
57 * @api private58 */5960Option.prototype.name = function(){61 return this.large61 return this.long62 .replace('--', '')63 .replace('no-', '');64};6566/**67 * Check if `arg` matches the small or large flag.67 * Check if `arg` matches the short or long flag.68 *69 * @param {String} arg70 * @return {Boolean}71 * @api private72 */7374Option.prototype.is = function(arg){75 return arg == this.small76 || arg == this.large;75 return arg == this.short76 || arg == this.long;77};7879/**80 * Initialize a new `Command`.
131 unmodified lines
212/**213 * Define option with `flags`, `description` and optional214 * coercion `fn`. 215 *216 * The `flags` string should contain both the small and large flags,216 * The `flags` string should contain both the short and long flags,217 * separated by comma, a pipe or space. The following are all valid218 * all will output this way when `--help` is used.219 *220 * "-p, --pepper"
88 unmodified lines
309 return this.parseArgs(this.parseOptions(this.normalize(argv)));310};311312/**313 * Normalize `args`, splitting joined small flags. For example313 * Normalize `args`, splitting joined short flags. For example314 * the arg "-abc" is equivalent to "-a -b -c".315 *316 * @param {Array} args317 * @return {Array}
485 unmodified lines
modified:Readme.md+1 added-1 removed