Permalink
Browse files

list example to defaults

  • Loading branch information...
1 parent 5553ea0 commit db4ab408d75df8b0b3840c94f1c2454ddeb2cb17 @tj committed Aug 15, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 examples/defaults
View
6 examples/defaults
@@ -6,11 +6,17 @@
var program = require('../');
+function list(val) {
+ return val.split(',').map(Number);
+}
+
program
.version('0.0.1')
.option('-t, --template-engine [engine]', 'Add template [engine] support', 'jade')
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
+ .option('-l, --list [items]', 'Specify list items defaulting to 1,2,3', list, [1,2,3])
.parse(process.argv);
console.log(' - %s template engine', program.templateEngine);
console.log(' - %s cheese', program.cheese);
+console.log(' - %j', program.list);

0 comments on commit db4ab40

Please sign in to comment.