Comparing version 0.4.4 to 0.4.5
15
cli.js
@@ -155,3 +155,2 @@ /** | ||
cli.options = {}; | ||
cli.args = []; | ||
cli.command = null; | ||
@@ -727,3 +726,3 @@ }; | ||
//default value (if specified) - otherwise fail | ||
if (!argv.length || argv[0][0] === '-') { | ||
if (!argv.length || (argv[0].length === 1 && argv[0][0] === '-')) { | ||
throw 'No value'; | ||
@@ -1075,3 +1074,3 @@ } | ||
if (errback) { | ||
return errback(err); | ||
return errback(err, stdout); | ||
} | ||
@@ -1093,4 +1092,5 @@ return cli.fatal('exec() failed\n' + err); | ||
var last_progress_call, progress_len = 74; | ||
cli.progress = function (progress) { | ||
cli.progress = function (progress, decimals) { | ||
if (progress < 0 || progress > 1 || isNaN(progress)) return; | ||
if (!decimals) decimals = 0; | ||
var now = (new Date()).getTime(); | ||
@@ -1111,3 +1111,8 @@ if (last_progress_call && (now - last_progress_call) < 100 && progress !== 1) { | ||
} | ||
cli.native.util.print('[' + str + '] ' + Math.floor(progress * 100) + '%' + (progress === 1 ? '\n' : '\u000D')); | ||
var pwr = Math.pow(10, decimals); | ||
var percentage = Math.floor(progress * 100 * pwr) / pwr + '%'; | ||
for (i = 0; i < decimals; i++) { | ||
percentage += ' '; | ||
} | ||
cli.native.util.print('[' + str + '] ' + percentage + (progress === 1 ? '\n' : '\u000D')); | ||
}; | ||
@@ -1114,0 +1119,0 @@ |
{ "name" : "cli", | ||
"description" : "A tool for rapidly building command line apps", | ||
"version" : "0.4.4", | ||
"version" : "0.4.5", | ||
"homepage" : "http://github.com/chriso/cli", | ||
@@ -5,0 +5,0 @@ "keywords" : ["cli","command line","opts","parseopt","opt","args","console","argsparse","optparse","daemon","autocomplete","command","autocompletion"], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49419
1199