Skip to content
Myr

deploy

This file

Path

examples/deploy

38 lines · 1.2 KiB

Last changed by

Merge pull request #1305 from tj/release/6.xTomoaki Abebefore adoptionc5a5e7b

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, --chdir <path>', 'change the working directory')10  .option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')11  .option('-T, --no-tests', 'ignore test hook');1213program14  .command('setup [env]')15  .description('run setup commands for all envs')16  .option('-s, --setup_mode [mode]', 'Which setup mode to use')17  .action(function(env, options) {18    const mode = options.setup_mode || 'normal';19    env = env || 'all';20    console.log('setup for %s env(s) with %s mode', env, mode);21  });2223program24  .command('exec <cmd>')25  .alias('ex')26  .description('execute the given remote cmd')27  .option('-e, --exec_mode <mode>', 'Which exec mode to use')28  .action(function(cmd, options) {29    console.log('exec "%s" using %s mode', cmd, options.exec_mode);30  }).on('--help', function() {31    console.log('  Examples:');32    console.log();33    console.log('    $ deploy exec sequential');34    console.log('    $ deploy exec async');35    console.log();36  });3738program.parse(process.argv);