Skip to content
Myr

pizza

This file

Path

examples/pizza

27 lines · 869 bytes

Last changed by

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

History of this file

Take it

The walk stopped after 200 commits: lines older than 2aad525 point at it.

Update dependencies (#1214)John Geebefore adoption2aad525

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

Merge pull request #1305 from tj/release/6.xTomoaki Abebefore adoptionc5a5e7b

lines 3–5why, one step back
3// const { Command } = require('commander'); // (normal include)
4const { Command } = require('../'); // include commander in git clone of commander repo5const program = new Command();

Update dependencies (#1214)John Geebefore adoption2aad525

lines 6–7why, one step back
6
7program

Change to safe storage of options by default, and change action parameters (#1409)John Geebefore adoptionf76bc71

line 8why, one step back
8 .description('An application for pizza ordering')

Update dependencies (#1214)John Geebefore adoption2aad525

lines 9–10why, one step back
9 .option('-p, --peppers', 'Add peppers')
10 .option('-c, --cheese <type>', 'Add the specified type of cheese', 'marble')

Merge pull request #1305 from tj/release/6.xTomoaki Abebefore adoptionc5a5e7b

lines 11–12why, one step back
11 .option('-C, --no-cheese', 'You do not want any cheese');
12

Change to safe storage of options by default, and change action parameters (#1409)John Geebefore adoptionf76bc71

line 13why, one step back
13program.parse();

Update dependencies (#1214)John Geebefore adoption2aad525

line 14why, one step back
14

Change to safe storage of options by default, and change action parameters (#1409)John Geebefore adoptionf76bc71

line 15why, one step back
15const options = program.opts();

Update dependencies (#1214)John Geebefore adoption2aad525

line 16why, one step back
16console.log('you ordered a pizza with:');

Change to safe storage of options by default, and change action parameters (#1409)John Geebefore adoptionf76bc71

lines 17–18why, one step back
17if (options.peppers) console.log(' - peppers');
18const cheese = !options.cheese ? 'no' : options.cheese;

Update dependencies (#1214)John Geebefore adoption2aad525

line 19why, one step back
19console.log(' - %s cheese', cheese);

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

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