Skip to content
Myr

deploy

This file

Path

examples/deploy

43 lines · 1.1 KiB

Last changed by

Switching to esm-only (#2464)John Geebefore adoptionf4bd470

History of this file

Take 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 back
1#!/usr/bin/env node
2

Switching to esm-only (#2464)John Geebefore adoptionf4bd470

line 3why, one step back
3import { Command } from 'commander';

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 4–27why, one step back
4const program = new Command();
56program7 .name('deploy')8 .version('0.0.1')9 .option('-c, --config <path>', 'set config path', './deploy.conf');1011program12 .command('setup [env]')13 .description('run setup commands for all envs')14 .option('-s, --setup_mode <mode>', 'Which setup mode to use', 'normal')15 .action((env, options) => {16 env = env || 'all';17 console.log('read config from %s', program.opts().config);18 console.log('setup for %s env(s) with %s mode', env, options.setup_mode);19 });2021program22 .command('exec <script>')23 .alias('ex')24 .description('execute the given remote cmd')25 .option('-e, --exec_mode <mode>', 'Which exec mode to use', 'fast')26 .action((script, options) => {27 console.log('read config from %s', program.opts().config);

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

lines 28–37why, one step back
28 console.log(
29 'exec "%s" using %s mode and config %s',30 script,31 options.exec_mode,32 program.opts().config,33 );34 })35 .addHelpText(36 'after',37 `

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 38–39why, one step back
38Examples:
39 $ deploy exec sequential

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

line 40why, one step back
40 $ deploy exec async`,

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 41why, one step back
41 );

Reformat code with Prettier (#2180)John Geebefore adoption1bdc749

line 42why, one step back
42

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

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