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

1#!/usr/bin/env node23// const { Command } = require('commander'); // (normal include)4const { Command } = require('../'); // include commander in git clone of commander repo5const program = new Command();67program8  .name('deploy')9  .version('0.0.1')10  .option('-c, --config <path>', 'set config path', './deploy.conf');1112program13  .command('setup [env]')14  .description('run setup commands for all envs')15  .option('-s, --setup_mode <mode>', 'Which setup mode to use', 'normal')16  .action((env, options) => {17    env = env || 'all';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);20  });2122program23  .command('exec <script>')24  .alias('ex')25  .description('execute the given remote cmd')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);30  }).addHelpText('after', `31Examples:32  $ deploy exec sequential33  $ deploy exec async`34  );35  36program.parse(process.argv);