options-defaults.js
This file
Path
examples/options-defaults.js
18 lines · 436 bytes · JavaScript
Last changed by
Use standard import in examples (#2168)John Geebefore adoption41b12cf
History of this fileTake it
The walk stopped after 200 commits: lines older than 0b0fbbe point at it.
Update dependencies (#1524)John Geebefore adoption0b0fbbe
lines 1–5why, one step back1#!/usr/bin/env node23// This is used as an example in the README for:4// Default option value5Use standard import in examples (#2168)John Geebefore adoption41b12cf
line 6why, one step back6const commander = require('commander');Update dependencies (#1524)John Geebefore adoption0b0fbbe
lines 7–18why, one step back7const program = new commander.Command();89program10 .option('-c, --cheese <type>', 'Add the specified type of cheese', 'blue');1112program.parse();1314console.log(`cheese: ${program.opts().cheese}`);1516// Try the following:17// node options-defaults.js18// node options-defaults.js --cheese stilton