Skip to content
Myr

pizza

This file

Path

examples/pizza

26 lines · 758 bytes

Last changed by

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

History of this file

Take it

The walk stopped after 200 commits: lines older than 6c06528 point at it.

Add getOptionValue and setOptionValue (#1521)John Geebefore adoption6c06528

lines 1–2why, one step back
1#!/usr/bin/env node
2

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

line 3why, one step back
3const { Command } = require('commander');

Add getOptionValue and setOptionValue (#1521)John Geebefore adoption6c06528

lines 4–18why, one step back
4const program = new Command();
56program7 .description('An application for pizza ordering')8 .option('-p, --peppers', 'Add peppers')9 .option('-c, --cheese <type>', 'Add the specified type of cheese', 'marble')10 .option('-C, --no-cheese', 'You do not want any cheese');1112program.parse();1314const options = program.opts();15console.log('you ordered a pizza with:');16if (options.peppers) console.log(' - peppers');17const cheese = !options.cheese ? 'no' : options.cheese;18console.log(' - %s cheese', cheese);

Make examples more consistent with "Try the following" (#1629)John Geebefore adoption2cc3a36

lines 19–26why, one step back
19
20// Try the following on macOS or Linux:21// ./pizza --help 22//23// Try the following:24// ./pizza --help 25// node pizza --peppers --cheese=blue26// node pizza --no-cheese