options-defaults.js
This file
Path
examples/options-defaults.js
21 lines · 442 bytes · JavaScript
Last changed by
Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
History of this fileTake it
The walk stopped after 200 commits: lines older than 3103c6b point at it.
Add more tests for implies (#1730)John Geebefore adoption3103c6b
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');Add more tests for implies (#1730)John Geebefore adoption3103c6b
lines 7–8why, one step back7const program = new commander.Command();8Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
lines 9–13why, one step back9program.option(10 '-c, --cheese <type>',11 'Add the specified type of cheese',12 'blue',13);Add more tests for implies (#1730)John Geebefore adoption3103c6b
lines 14–21why, one step back1415program.parse();1617console.log(`cheese: ${program.opts().cheese}`);1819// Try the following:20// node options-defaults.js21// node options-defaults.js --cheese stilton