Skip to content
Myr

pm

This file

Path

examples/pm

36 lines · 1.1 KiB

Last changed by

Update README and examples for allowExcessArguments change (#2266)John Geebefore adoption2c9051a

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–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 more tests for implies (#1730)John Geebefore adoption3103c6b

lines 4–16why, one step back
4const program = new Command();
56// Example of subcommands which are implemented as stand-alone executable files.7//8// When `.command()` is invoked with a description argument,9// this tells Commander that you're going to use a stand-alone executable for the subcommand.10//11// Only `install` and `list` are implemented, see pm-install and pm-list.js1213program14 .name('pm')15 .version('0.0.1')16 .description('Fake package manager')

Update README and examples for allowExcessArguments change (#2266)John Geebefore adoption2c9051a

line 17why, one step back
17 .command('install [package-names...]', 'install one or more packages')

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 18–23why, one step back
18 .alias('i')
19 .command('search [query]', 'search with optional query')20 .alias('s')21 .command('update', 'update installed packages', {22 executableFile: 'myUpdateSubCommand',23 })

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

lines 24–36why, one step back
24 .command('list', 'list packages installed', { isDefault: true });
2526program.parse(process.argv);2728// Try the following on macOS or Linux:29// ./examples/pm30//31// Try the following:32// node pm33// node pm help install34// node pm install -h35// node pm install foo bar baz36// node pm install foo bar baz --force