Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Aug 14, 2011
1 parent 2a175d7 commit 236ef92
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (program.bbq) console.log(' - bbq');
console.log(' - %s cheese', program.cheese || 'marble');
```

Small flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`.
Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`.

## Automated --help

Expand Down
16 changes: 8 additions & 8 deletions lib/commander.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ function Option(flags, description) {
this.optional = ~flags.indexOf('[');
this.bool = !~flags.indexOf('-no-');
flags = flags.split(/[ ,|]+/)
this.small = flags.shift();
this.large = flags.shift();
this.short = flags.shift();
this.long = flags.shift();
this.description = description;
}

Expand All @@ -58,22 +58,22 @@ function Option(flags, description) {
*/

Option.prototype.name = function(){
return this.large
return this.long
.replace('--', '')
.replace('no-', '');
};

/**
* Check if `arg` matches the small or large flag.
* Check if `arg` matches the short or long flag.
*
* @param {String} arg
* @return {Boolean}
* @api private
*/

Option.prototype.is = function(arg){
return arg == this.small
|| arg == this.large;
return arg == this.short
|| arg == this.long;
};

/**
Expand Down Expand Up @@ -213,7 +213,7 @@ Command.prototype.action = function(fn){
* Define option with `flags`, `description` and optional
* coercion `fn`.
*
* The `flags` string should contain both the small and large flags,
* The `flags` string should contain both the short and long flags,
* separated by comma, a pipe or space. The following are all valid
* all will output this way when `--help` is used.
*
Expand Down Expand Up @@ -310,7 +310,7 @@ Command.prototype.parse = function(argv){
};

/**
* Normalize `args`, splitting joined small flags. For example
* Normalize `args`, splitting joined short flags. For example
* the arg "-abc" is equivalent to "-a -b -c".
*
* @param {Array} args
Expand Down

0 comments on commit 236ef92

Please sign in to comment.