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

1#!/usr/bin/env node23import { Command } from 'commander';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);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    `38Examples:39  $ deploy exec sequential40  $ deploy exec async`,41  );4243program.parse(process.argv);