options-variadic.js
This file
Path
examples/options-variadic.js
21 lines · 709 bytes · JavaScript
Last changed by
Make examples more consistent with "Try the following" (#1629)John Geebefore adoption2cc3a36
History of this fileTake it
Merge pull request #1305 from tj/release/6.xTomoaki Abebefore adoptionc5a5e7b
lines 1–18why, one step back1#!/usr/bin/env node23// This is used as an example in the README for variadic options.45// const commander = require('commander'); // (normal include)6const commander = require('../'); // include commander in git clone of commander repo7const program = new commander.Command();89program10 .option('-n, --number <value...>', 'specify numbers')11 .option('-l, --letter [value...]', 'specify letters');1213program.parse();1415console.log('Options: ', program.opts());16console.log('Remaining arguments: ', program.args);1718// Try the following:Make examples more consistent with "Try the following" (#1629)John Geebefore adoption2cc3a36
lines 19–21why, one step back19// node options-variadic.js -n 1 2 3 --letter a b c20// node options-variadic.js --letter=A -n80 operand21// node options-variadic.js --letter -n 1 -n 2 3 -- operand