@bowtie/cli
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "@bowtie/cli", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Internal BowTie CLI Tools", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,2 +7,5 @@ const dockerCompose = require('./dockerCompose') | ||
dockerCompose(opts) | ||
opts.args.shift() | ||
opts.args.shift() | ||
}; |
@@ -7,2 +7,5 @@ const bundleExec = require('./bundleExec') | ||
bundleExec(opts) | ||
opts.args.shift() | ||
opts.args.shift() | ||
}; |
@@ -13,2 +13,7 @@ const spawn = require('../spawn'); | ||
dockerCompose({ cli, info, args }) | ||
opts.args.shift() | ||
opts.args.shift() | ||
opts.args.shift() | ||
opts.args.shift() | ||
} else { | ||
@@ -23,3 +28,5 @@ args.unshift('run') | ||
}) | ||
opts.args.shift() | ||
} | ||
}; |
@@ -7,2 +7,4 @@ const dockerCompose = require('./dockerCompose') | ||
dockerCompose(opts) | ||
opts.args.shift() | ||
}; |
@@ -1,3 +0,1 @@ | ||
const shell = require('shelljs'); | ||
const stop = require('./stop'); | ||
@@ -4,0 +2,0 @@ const build = require('./build'); |
@@ -7,2 +7,5 @@ const bundleExec = require('./bundleExec') | ||
bundleExec(opts) | ||
opts.args.shift() | ||
opts.args.shift() | ||
}; |
@@ -7,2 +7,4 @@ const dockerCompose = require('./dockerCompose') | ||
dockerCompose(opts) | ||
opts.args.shift() | ||
}; |
@@ -7,2 +7,6 @@ const dockerCompose = require('./dockerCompose') | ||
dockerCompose({ cli, info, args }) | ||
opts.args.shift() | ||
opts.args.shift() | ||
opts.args.shift() | ||
}; |
const dockerCompose = require('./dockerCompose') | ||
const logs = require('./logs') | ||
module.exports = (opts) => { | ||
opts.args.unshift('up') | ||
opts.args.unshift('up', '-d') | ||
dockerCompose(opts) | ||
opts.args.shift() | ||
opts.args.shift() | ||
if (opts.cli.options.watch) { | ||
logs(opts) | ||
} | ||
}; |
@@ -23,2 +23,8 @@ const Cmr1Cli = require('cmr1-cli'); | ||
typeLabel: '[underline]{service} (default="app")' | ||
}, | ||
{ | ||
name: 'watch', | ||
alias: 'w', | ||
type: Boolean, | ||
description: 'watch log output' | ||
} | ||
@@ -25,0 +31,0 @@ ]; |
@@ -1,3 +0,8 @@ | ||
const spawn = require('child_process').spawn; | ||
const spawn = require('child_process').spawnSync; | ||
var cleanExit = function() { process.exit() }; | ||
process.on('SIGINT', cleanExit); // catch ctrl-c | ||
process.on('SIGTERM', cleanExit); // catch kill | ||
module.exports = ({ cli, cmd, args, env }) => { | ||
@@ -9,23 +14,17 @@ const opts = { | ||
cli.log(`Running command: ${cmd} ${args.join(' ')}`) | ||
cli.warn(`Running command: ${cmd} ${args.join(' ')}`) | ||
const res = spawn(cmd, args, opts) | ||
if (!res) { | ||
cli.error('Unable to run command') | ||
if (res.error) { | ||
cli.error(res.error) | ||
} | ||
res.on('error', (err) => { | ||
cli.error(err) | ||
}); | ||
res.on('close', (code) => { | ||
const msg = `command "${cmd} ${args.join(' ')}" exited with code ${code}` | ||
if (code !== 0) { | ||
cli.warn(msg) | ||
} else { | ||
cli.debug(msg) | ||
} | ||
}); | ||
const msg = `command "${cmd} ${args.join(' ')}" exited with code ${res.status}` | ||
if (res.status !== 0) { | ||
cli.warn(msg) | ||
} else { | ||
cli.debug(msg) | ||
} | ||
}; |
13890
437