Skip to content
Myr

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 file

Take 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 back
1#!/usr/bin/env node
23// This is used as an example in the README for:4// Default option value5

Use standard import in examples (#2168)John Geebefore adoption41b12cf

line 6why, one step back
6const commander = require('commander');

Add more tests for implies (#1730)John Geebefore adoption3103c6b

lines 7–8why, one step back
7const program = new commander.Command();
8

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 9–13why, one step back
9program.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 back
14
15program.parse();1617console.log(`cheese: ${program.opts().cheese}`);1819// Try the following:20// node options-defaults.js21// node options-defaults.js --cheese stilton