Skip to content
Myr

pm-install

This file

Path

examples/pm-install

24 lines · 561 bytes

Last changed by

Tidy up some old examples (#1604)John Geebefore adoptionc1472bc

History of this file

Take it

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

Tidy up example now check for required command arguments (#1320)John Geebefore adoptionf47bdf5

lines 1–19why, one step back
1#!/usr/bin/env node
23// const { Command } = require('commander'); // (normal include)4const { Command } = require('../'); // include commander in git clone of commander repo5const program = new Command();67program8 .option('-f, --force', 'force installation');910program.parse(process.argv);1112const pkgs = program.args;1314if (!pkgs.length) {15 console.error('packages required');16 process.exit(1);17}1819console.log();

Tidy up some old examples (#1604)John Geebefore adoptionc1472bc

line 20why, one step back
20if (program.opts().force) console.log(' force: install');

Tidy up example now check for required command arguments (#1320)John Geebefore adoptionf47bdf5

lines 21–24why, one step back
21pkgs.forEach(function(pkg) {
22 console.log(' install : %s', pkg);23});24console.log();