Comparing version 0.2.1 to 0.2.2
@@ -12,3 +12,3 @@ #!/usr/bin/env node | ||
.alias('b', 'base') | ||
.describe('b', 'Numeric base to display the output in.') | ||
.describe('b', 'Numeric base to display the final output in.') | ||
.default('b', 10) | ||
@@ -15,0 +15,0 @@ .argv |
30
index.js
var path = require('path'); | ||
var wordwrap = require('wordwrap'); | ||
@@ -188,2 +189,8 @@ /* Hack an instance of Argv with process.argv into Argv | ||
var wrap = null; | ||
self.wrap = function (cols) { | ||
wrap = cols; | ||
return self; | ||
}; | ||
self.showHelp = function (fn) { | ||
@@ -232,2 +239,13 @@ if (!fn) fn = console.error; | ||
var desc = descriptions[key] || ''; | ||
if (wrap) { | ||
desc = wordwrap(switchlen + 4, wrap)(desc) | ||
.slice(switchlen + 4) | ||
; | ||
} | ||
var spadding = new Array( | ||
Math.max(switchlen - kswitch.length + 3, 0) | ||
).join(' '); | ||
var dpadding = new Array( | ||
@@ -237,5 +255,2 @@ Math.max(desclen - desc.length + 1, 0) | ||
var spadding = new Array( | ||
Math.max(switchlen - kswitch.length + 3, 0) | ||
).join(' '); | ||
var type = null; | ||
@@ -245,4 +260,7 @@ | ||
if (flags.strings[key]) type = '[string]'; | ||
if (dpadding.length > 0) desc += dpadding; | ||
if (!wrap && dpadding.length > 0) { | ||
desc += dpadding; | ||
} | ||
var prelude = ' ' + kswitch + spadding; | ||
@@ -252,2 +270,6 @@ var body = [ | ||
type, | ||
wrap | ||
? '\n' + new Array(prelude.length + 3).join(' ') | ||
: null | ||
, | ||
demanded[key] | ||
@@ -254,0 +276,0 @@ ? '[required]' |
{ | ||
"name" : "optimist", | ||
"version" : "0.2.1", | ||
"version" : "0.2.2", | ||
"description" : "Light-weight option parsing with an argv hash. No optstrings attached.", | ||
"main" : "./index.js", | ||
"directories" : { | ||
"lib" : ".", | ||
"test" : "test", | ||
"example" : "examples" | ||
}, | ||
"dependencies" : { | ||
"wordwrap" : ">=0.0.1 <0.1" | ||
}, | ||
"devDependencies" : { | ||
"expresso" : "=0.7.x" | ||
}, | ||
"repository" : { | ||
@@ -7,0 +18,0 @@ "type" : "git", |
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
37774
1007
1
1
+ Addedwordwrap@>=0.0.1 <0.1
+ Addedwordwrap@0.0.3(transitive)