mirror of
https://github.com/expo/commander.js.git
synced 2026-11-15 03:38:05 -10:00
38 lines
1.2 KiB
JavaScript
Executable File
38 lines
1.2 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
// const program = require('commander'); // (normal include)
|
|
const program = require('../'); // include commander in git clone of commander repo
|
|
|
|
program
|
|
.version('0.0.1')
|
|
.option('-C, --chdir <path>', 'change the working directory')
|
|
.option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
|
.option('-T, --no-tests', 'ignore test hook');
|
|
|
|
program
|
|
.command('setup [env]')
|
|
.description('run setup commands for all envs')
|
|
.option('-s, --setup_mode [mode]', 'Which setup mode to use')
|
|
.action(function(env, options) {
|
|
const mode = options.setup_mode || 'normal';
|
|
env = env || 'all';
|
|
console.log('setup for %s env(s) with %s mode', env, mode);
|
|
});
|
|
|
|
program
|
|
.command('exec <cmd>')
|
|
.alias('ex')
|
|
.description('execute the given remote cmd')
|
|
.option('-e, --exec_mode <mode>', 'Which exec mode to use')
|
|
.action(function(cmd, options) {
|
|
console.log('exec "%s" using %s mode', cmd, options.exec_mode);
|
|
}).on('--help', function() {
|
|
console.log(' Examples:');
|
|
console.log();
|
|
console.log(' $ deploy exec sequential');
|
|
console.log(' $ deploy exec async');
|
|
console.log();
|
|
});
|
|
|
|
program.parse(process.argv);
|