pizza
This file
Path
examples/pizza
26 lines · 748 bytes
Last changed by
Switching to esm-only (#2464)John Geebefore adoptionf4bd470
History of this fileTake it
The walk stopped after 200 commits: lines older than 471ec40 point at it.
Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 1–2why, one step back1#!/usr/bin/env node2Switching to esm-only (#2464)John Geebefore adoptionf4bd470
line 3why, one step back3import { Command } from 'commander';Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 4–20why, one step back4const 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);1920// Try the following on macOS or Linux:Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
line 21why, one step back21// ./pizza --helpAdd copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 22–23why, one step back22//23// Try the following:Switching to esm-only (#2464)John Geebefore adoptionf4bd470
line 24why, one step back24// node pizza --helpAdd copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 25–26why, one step back25// node pizza --peppers --cheese=blue26// node pizza --no-cheese