Use --verbose instead of --debug as argument to enabled additional output.
* New --verbose argument
* Adjusted info message so the developer knows how to enabled verbose mode.
diff --git a/bin/templates/project/cordova/build b/bin/templates/project/cordova/build
index 91c3847..bcee390 100755
--- a/bin/templates/project/cordova/build
+++ b/bin/templates/project/cordova/build
@@ -28,9 +28,9 @@
var www = path.join(root, 'www');
check_reqs(function () {
- var argv = require('optimist').boolean(['debug']).string(['framework']).argv;
- if (argv.debug) {
- require('./lib/config').debugMode();
+ var argv = require('optimist').boolean(['verbose']).string(['framework']).argv;
+ if (argv.verbose) {
+ require('./lib/config').verboseMode();
}
return build(root, PLATFORMS.ALL, false, undefined, argv.framework, false);
});
diff --git a/bin/templates/project/cordova/lib/config.js b/bin/templates/project/cordova/lib/config.js
index fe65a6f..26a9b7e 100644
--- a/bin/templates/project/cordova/lib/config.js
+++ b/bin/templates/project/cordova/lib/config.js
@@ -23,21 +23,21 @@
/**
* The configuration is used by other tasks to access shared properties, such as if the tasks are
- * running in debug mode (verbose).
+ * running in verbose mode (more logs, and outputs from various commands).
*/
function Config() {
- this._debug = false;
+ this._verbose = false;
shellCfg.silent = true;
}
Config.prototype = {
- debugMode: function () {
- this._debug = true;
+ verboseMode: function () {
+ this._verbose = true;
shellCfg.silent = false;
},
- inDebugMode: function () {
- return this._debug;
+ inVerboseMode: function () {
+ return this._verbose;
}
};
diff --git a/bin/templates/project/cordova/lib/logger.js b/bin/templates/project/cordova/lib/logger.js
index 9f263ef..23342c6 100644
--- a/bin/templates/project/cordova/lib/logger.js
+++ b/bin/templates/project/cordova/lib/logger.js
@@ -26,7 +26,7 @@
* Output debug messages in white. If not in verbose mode, nothing is output.
*/
module.exports.debug = function (msg) {
- if (config.inDebugMode()) {
+ if (config.inVerboseMode()) {
console.log(msg);
}
};
diff --git a/bin/templates/project/cordova/lib/utils.js b/bin/templates/project/cordova/lib/utils.js
index 403da44..1798704 100644
--- a/bin/templates/project/cordova/lib/utils.js
+++ b/bin/templates/project/cordova/lib/utils.js
@@ -48,12 +48,17 @@
module.exports.execSync = function(cmd, silent) {
logger.debug(cmd);
- silent = (typeof silent === 'boolean') ? silent : !config.inDebugMode();
+ silent = (typeof silent === 'boolean') ? silent : !config.inVerboseMode();
var res = shell.exec(cmd, { silent: silent });
if (res.code !== 0) {
logger.error(cmd.green + " " + "FAILED".underline);
logger.error(res.output);
- logger.error('You can run with --debug to debug more easily.');
+
+ if (!config.inVerboseMode()) {
+ logger.warn('Try running the task again with --verbose for more logs.');
+ logger.warn('Example: cordova run -- --verbose');
+ }
+
process.exit(1);
}
@@ -64,13 +69,18 @@
logger.debug(cmd);
var deferred = Q.defer();
- silent = (typeof silent === 'boolean') ? silent : !config.inDebugMode();
+ silent = (typeof silent === 'boolean') ? silent : !config.inVerboseMode();
shell.exec(cmd, { async: true, silent: silent }, function (code, output) {
var res = { code: code, output: output };
if (res.code !== 0) {
logger.error(cmd.green + " " + "FAILED".underline);
logger.error(res.output);
- logger.error('You can run with --debug to debug more easily.')
+
+ if (!config.inVerboseMode()) {
+ logger.warn('Try running the task again with --verbose for more logs.');
+ logger.warn('Example: cordova run -- --verbose');
+ }
+
process.exit(1);
}
deferred.resolve(res);
diff --git a/bin/templates/project/cordova/run b/bin/templates/project/cordova/run
index fc36457..536662e 100755
--- a/bin/templates/project/cordova/run
+++ b/bin/templates/project/cordova/run
@@ -28,9 +28,9 @@
var www = path.join(root, 'www');
check_reqs(function () {
- var argv = require('optimist').boolean(['device', 'emulator', 'debug', 'nobuild']).string(['target', 'framework']).argv;
- if (argv.debug) {
- require('./lib/config').debugMode();
+ var argv = require('optimist').boolean(['device', 'emulator', 'debug', 'nobuild', 'verbose']).string(['target', 'framework']).argv;
+ if (argv.verbose) {
+ require('./lib/config').verboseMode();
}
return run(root, !argv.device, argv.debug, argv.target, argv.nobuild, argv.emulator, argv.framework);
});