Skip to content

Commit 2ada3de

Browse files
committed
refactor (clirunner) read verbosity from config
1 parent 2565fb7 commit 2ada3de

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

lib/cli/clirunner.js

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,36 +51,34 @@ program
5151
.command('*', null, { noHelp: true })
5252
.action(() => program.help());
5353

54-
program.on('verbose', function() {
55-
logger.verbose = true;
56-
});
57-
5854
program.parse(process.argv);
5955

6056
if (!program.args.length) {
6157
debug();
6258
}
6359

6460
function debug() {
65-
buildOptions(true).then((opts) => {
66-
const runner = CodeRunner.debug(opts);
61+
buildOptions(true)
62+
.then(opts => {
63+
const runner = CodeRunner.debug(opts);
6764

68-
function handleTermination() {
69-
logger.info('Termination signal received. Shutting down.');
65+
function handleTermination() {
66+
logger.info('Termination signal received. Shutting down.');
7067

71-
runner.stop().then(exit, exitWithError);
72-
}
68+
runner.stop().then(exit, exitWithError);
69+
}
7370

74-
process.on('SIGINT', handleTermination);
75-
process.on('SIGTERM', handleTermination);
76-
}, exitWithError);
71+
process.on('SIGINT', handleTermination);
72+
process.on('SIGTERM', handleTermination);
73+
})
74+
.catch(exitWithError);
7775
}
7876

7977
function cloud() {
8078
logger.prefixed = true;
8179

8280
buildOptions()
83-
.then((opts) => {
81+
.then(opts => {
8482
opts.driverHost = this.driverHost;
8583
opts.driverPort = this.driverPort;
8684
opts.driverRequestId = this.driverRequestId;
@@ -98,9 +96,8 @@ function cloud() {
9896
}
9997

10098
function deploy() {
101-
buildOptions(true)
102-
.then((opts) => {
103-
opts.keepZip = this.keepZip;
99+
buildOptions(true).then(opts => {
100+
opts.keepZip = this.keepZip || opts.keepZip;
104101

105102
return CodeRunner.deploy(opts);
106103
})
@@ -133,6 +130,8 @@ function buildOptions(appIsRequired) {
133130
opts.backendless.msgBroker.port = program.msgBrokerPort || opts.backendless.msgBroker.port;
134131
opts.backendless.repoPath = program.repoPath || opts.backendless.repoPath || DEFAULT_REPO_PATH;
135132

133+
opts.verbose = logger.verbose = program.verbose || opts.verbose;
134+
136135
if (appIsRequired) {
137136
opts.app = opts.app || {};
138137

0 commit comments

Comments
 (0)