Skip to content
Myr

deploy

This file

Path

examples/deploy

35 lines · 1.1 KiB

Last changed by

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

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  .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);28    console.log('exec "%s" using %s mode and config %s', script, options.exec_mode, program.opts().config);29  }).addHelpText('after', `30Examples:31  $ deploy exec sequential32  $ deploy exec async`33  );34  35program.parse(process.argv);