defaults
This file
Path
examples/defaults
22 lines · 607 bytes
Last changed by
list example to defaultsTj Holowaychukbefore adoptiondb4ab40
History of this fileTake it
Added default option value supportTj Holowaychukbefore adoption9413fe9
lines 1–8why, one step back1#!/usr/bin/env node23/**4 * Module dependencies.5 */67var program = require('../');8list example to defaultsTj Holowaychukbefore adoptiondb4ab40
lines 9–12why, one step back9function list(val) {10 return val.split(',').map(Number);11}12Added default option value supportTj Holowaychukbefore adoption9413fe9
lines 13–16why, one step back13program14 .version('0.0.1')15 .option('-t, --template-engine [engine]', 'Add template [engine] support', 'jade')16 .option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')list example to defaultsTj Holowaychukbefore adoptiondb4ab40
line 17why, one step back17 .option('-l, --list [items]', 'Specify list items defaulting to 1,2,3', list, [1,2,3])Added default option value supportTj Holowaychukbefore adoption9413fe9
lines 18–21why, one step back18 .parse(process.argv);1920console.log(' - %s template engine', program.templateEngine);21console.log(' - %s cheese', program.cheese);list example to defaultsTj Holowaychukbefore adoptiondb4ab40
line 22why, one step back22console.log(' - %j', program.list);