Skip to content
Myr

options-defaults.js

This file

Path

examples/options-defaults.js

21 lines · 429 bytes · JavaScript

Last changed by

Switching to esm-only (#2464)John Geebefore adoptionf4bd470

History of this file

Take it

The walk stopped after 200 commits: lines older than 471ec40 point at it.

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

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

Switching to esm-only (#2464)John Geebefore adoptionf4bd470

lines 6–7why, one step back
6import { Command } from 'commander';
7const program = new Command();

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 8why, one step back
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 copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

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