Skip to content
Myr

deploy

This file

Path

examples/deploy

36 lines · 1.2 KiB

Last changed by

Merge pull request #1683 from tj/release/9.xJohn Geebefore adoption02a124c

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–7why, 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();67program

Merge pull request #1683 from tj/release/9.xJohn Geebefore adoption02a124c

line 8why, one step back
8 .name('deploy')

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

line 9why, one step back
9 .version('0.0.1')

Change to safe storage of options by default, and change action parameters (#1409)John Geebefore adoptionf76bc71

line 10why, one step back
10 .option('-c, --config <path>', 'set config path', './deploy.conf');

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

lines 11–14why, one step back
11
12program13 .command('setup [env]')14 .description('run setup commands for all envs')

Change to safe storage of options by default, and change action parameters (#1409)John Geebefore adoptionf76bc71

lines 15–16why, one step back
15 .option('-s, --setup_mode <mode>', 'Which setup mode to use', 'normal')
16 .action((env, options) => {

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

line 17why, one step back
17 env = env || 'all';

Change to safe storage of options by default, and change action parameters (#1409)John Geebefore adoptionf76bc71

lines 18–19why, one step back
18 console.log('read config from %s', program.opts().config);
19 console.log('setup for %s env(s) with %s mode', env, options.setup_mode);

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

lines 20–22why, one step back
20 });
2122program

Change to safe storage of options by default, and change action parameters (#1409)John Geebefore adoptionf76bc71

line 23why, one step back
23 .command('exec <script>')

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

lines 24–25why, one step back
24 .alias('ex')
25 .description('execute the given remote cmd')

Change to safe storage of options by default, and change action parameters (#1409)John Geebefore adoptionf76bc71

lines 26–29why, one step back
26 .option('-e, --exec_mode <mode>', 'Which exec mode to use', 'fast')
27 .action((script, options) => {28 console.log('read config from %s', program.opts().config);29 console.log('exec "%s" using %s mode and config %s', script, options.exec_mode, program.opts().config);

Expand help customisation with .addHelpText (#1296)John Geebefore adoptiond26a26d

lines 30–35why, one step back
30 }).addHelpText('after', `
31Examples:32 $ deploy exec sequential33 $ deploy exec async`34 );35

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

line 36why, one step back
36program.parse(process.argv);