pm
This file
Path
examples/pm
36 lines · 1.0 KiB
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–16why, one step back4const 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 back17 .command('install [package-names...]', 'install one or more packages')Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
lines 18–23why, one step back18 .alias('i')19 .command('search [query]', 'search with optional query')20 .alias('s')21 .command('update', 'update installed packages', {22 executableFile: 'myUpdateSubCommand',23 })Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40
lines 24–36why, one step back24 .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