deploy
This file
Path
examples/deploy
36 lines · 1.1 KiB
Last changed by
Expand help customisation with .addHelpText (#1296)John Geebefore adoptiond26a26d
History of this fileTake 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 }).addHelpText('after', `31Examples:32 $ deploy exec sequential33 $ deploy exec async`34 );35 36program.parse(process.argv);