Skip to content

Commit

Permalink
refactor (clirunner) read verbosity from config
Browse files Browse the repository at this point in the history
  • Loading branch information
vengrov committed Mar 28, 2016
1 parent 2565fb7 commit 2ada3de
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions lib/cli/clirunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,36 +51,34 @@ program
.command('*', null, { noHelp: true })
.action(() => program.help());

program.on('verbose', function() {
logger.verbose = true;
});

program.parse(process.argv);

if (!program.args.length) {
debug();
}

function debug() {
buildOptions(true).then((opts) => {
const runner = CodeRunner.debug(opts);
buildOptions(true)
.then(opts => {
const runner = CodeRunner.debug(opts);

function handleTermination() {
logger.info('Termination signal received. Shutting down.');
function handleTermination() {
logger.info('Termination signal received. Shutting down.');

runner.stop().then(exit, exitWithError);
}
runner.stop().then(exit, exitWithError);
}

process.on('SIGINT', handleTermination);
process.on('SIGTERM', handleTermination);
}, exitWithError);
process.on('SIGINT', handleTermination);
process.on('SIGTERM', handleTermination);
})
.catch(exitWithError);
}

function cloud() {
logger.prefixed = true;

buildOptions()
.then((opts) => {
.then(opts => {
opts.driverHost = this.driverHost;
opts.driverPort = this.driverPort;
opts.driverRequestId = this.driverRequestId;
Expand All @@ -98,9 +96,8 @@ function cloud() {
}

function deploy() {
buildOptions(true)
.then((opts) => {
opts.keepZip = this.keepZip;
buildOptions(true).then(opts => {
opts.keepZip = this.keepZip || opts.keepZip;

return CodeRunner.deploy(opts);
})
Expand Down Expand Up @@ -133,6 +130,8 @@ function buildOptions(appIsRequired) {
opts.backendless.msgBroker.port = program.msgBrokerPort || opts.backendless.msgBroker.port;
opts.backendless.repoPath = program.repoPath || opts.backendless.repoPath || DEFAULT_REPO_PATH;

opts.verbose = logger.verbose = program.verbose || opts.verbose;

if (appIsRequired) {
opts.app = opts.app || {};

Expand Down

0 comments on commit 2ada3de

Please sign in to comment.