pm
This file
Path
examples/pm
36 lines · 1.0 KiB
Last changed by
Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
History of this fileTake it
The walk stopped after 200 commits: lines older than a9c9f17 point at it.
Add link for version diffJohn Geebefore adoptiona9c9f17
lines 1–2why, one step back1#!/usr/bin/env node2Use standard import in examples (#2168)John Geebefore adoption41b12cf
line 3why, one step back3const { Command } = require('commander');Add link for version diffJohn Geebefore adoptiona9c9f17
lines 4–5why, one step back4const program = new Command();5Make examples more consistent with "Try the following" (#1629)John Geebefore adoption2cc3a36
lines 6–12why, one step back6// 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.js12Add link for version diffJohn Geebefore adoptiona9c9f17
line 13why, one step back13programMerge pull request #1683 from tj/release/9.xJohn Geebefore adoption02a124c
line 14why, one step back14 .name('pm')Add link for version diffJohn Geebefore adoptiona9c9f17
lines 15–16why, one step back15 .version('0.0.1')16 .description('Fake package manager')Reformat code with Prettier (#2180)John Geebefore adoption1bdc749
lines 17–23why, one step back17 .command('install [name]', 'install one or more packages')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 link for version diffJohn Geebefore adoptiona9c9f17
lines 24–27why, one step back24 .command('list', 'list packages installed', { isDefault: true });2526program.parse(process.argv);27Make examples more consistent with "Try the following" (#1629)John Geebefore adoption2cc3a36
lines 28–30why, one step back28// Try the following on macOS or Linux:29// ./examples/pm30//Add link for version diffJohn Geebefore adoptiona9c9f17
line 31why, one step back31// Try the following:Make examples more consistent with "Try the following" (#1629)John Geebefore adoption2cc3a36
lines 32–36why, one step back32// node pm33// node pm help install34// node pm install -h35// node pm install foo bar baz36// node pm install foo bar baz --force