options-defaults.js
This file
Path
examples/options-defaults.js
19 lines · 545 bytes · JavaScript
Last changed by
Change to safe storage of options by default, and change action parameters (#1409)John Geebefore adoptionf76bc71
History of this fileTake it
The walk stopped after 200 commits: lines older than 2aad525 point at it.
Update dependencies (#1214)John Geebefore adoption2aad525
lines 1–12why, one step back1#!/usr/bin/env node23// This is used as an example in the README for:4// Default option value56// const commander = require('commander'); // (normal include)7const commander = require('../'); // include commander in git clone of commander repo8const program = new commander.Command();910program11 .option('-c, --cheese <type>', 'Add the specified type of cheese', 'blue');12Change to safe storage of options by default, and change action parameters (#1409)John Geebefore adoptionf76bc71
line 13why, one step back13program.parse();Update dependencies (#1214)John Geebefore adoption2aad525
line 14why, one step back14Change to safe storage of options by default, and change action parameters (#1409)John Geebefore adoptionf76bc71
lines 15–19why, one step back15console.log(`cheese: ${program.opts().cheese}`);1617// Try the following:18// node options-defaults.js19// node options-defaults.js --cheese stilton