Skip to content

Commit

Permalink
options works again, too lazy to write a proper test right now
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed May 15, 2011
1 parent f742e54 commit 75aecce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 12 additions & 5 deletions examples/line_count_options.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
#!/usr/bin/env node
var argv = require('optimist')
.usage('Count the lines in a file.\nUsage: $0')
.options('f', {
demand : true,
alias : 'file',
description : 'Load a file'
.options({
file : {
demand : true,
alias : 'f',
description : 'Load a file'
},
base : {
alias : 'b',
description : 'Numeric base to use for output',
default : 10,
},
})
.argv
;
Expand All @@ -18,5 +25,5 @@ s.on('data', function (buf) {
});

s.on('end', function () {
console.log(lines);
console.log(lines.toString(argv.base));
});
2 changes: 0 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ function Argv (args, cwd) {
});
}
else {
var opt = opts[key];

if (opt.alias) self.alias(key, opt.alias);
if (opt.demand) self.demand(key);
if (opt.default) self.default(key, opt.default);
Expand Down

0 comments on commit 75aecce

Please sign in to comment.