Comparing version 3.4.0 to 3.4.4
@@ -1,5 +0,5 @@ | ||
var path = require('path'); | ||
var Parser = require('./lib/parser'); | ||
var Usage = require('./lib/usage'); | ||
var Validation = require('./lib/validation'); | ||
var path = require('path'), | ||
Parser = require('./lib/parser'), | ||
Usage = require('./lib/usage'), | ||
Validation = require('./lib/validation'); | ||
@@ -6,0 +6,0 @@ /* Hack an instance of Argv with process.argv into Argv |
// fancy-pants parsing of argv, originally forked | ||
// from minimist: https://www.npmjs.com/package/minimist | ||
var fs = require('fs'), | ||
path = require('path'), | ||
S = require('string'); | ||
var camelCase = require('camelcase'), | ||
fs = require('fs'), | ||
path = require('path'); | ||
@@ -35,6 +35,2 @@ module.exports = function (args, opts) { | ||
function toCamelCase(str) { | ||
return S(str).camelize().s; | ||
} | ||
var aliases = {}, | ||
@@ -49,3 +45,3 @@ newAliases = {}; | ||
if (/-/.test(key) && !opts.alias[key]) { | ||
var c = toCamelCase(key); | ||
var c = camelCase(key); | ||
aliases[key] = aliases[key] || []; | ||
@@ -223,3 +219,3 @@ // don't allow the same key to be added multiple times. | ||
if (/-/.test(key) && !(aliases[key] && aliases[key].length)) { | ||
var c = toCamelCase(key); | ||
var c = camelCase(key); | ||
aliases[key] = [c]; | ||
@@ -353,3 +349,3 @@ newAliases[c] = true; | ||
if (/-/.test(x)) { | ||
var c = toCamelCase(x); | ||
var c = camelCase(x); | ||
aliases[key].push(c); | ||
@@ -356,0 +352,0 @@ newAliases[c] = true; |
// this file handles outputting usage instructions, | ||
// failures, etc. keeps logging in one place. | ||
var S = require('string'), | ||
var decamelize = require('decamelize'), | ||
wordwrap = require('wordwrap'), | ||
@@ -202,5 +202,5 @@ wsize = require('window-size'); | ||
if (epilog) { | ||
var e = epilog; | ||
if (wrap) e = wordwrap(0, wrap)(epilog); | ||
help.push(epilog, ''); | ||
var e = epilog.replace(/\$0/g, yargs.$0); | ||
if (wrap) e = wordwrap(0, wrap)(e); | ||
help.push(e, ''); | ||
} | ||
@@ -222,3 +222,3 @@ | ||
if (value === undefined) return null; | ||
if (defaultDescription) { | ||
@@ -232,3 +232,3 @@ string += defaultDescription; | ||
case 'function': | ||
string += '(' + (value.name.length ? S(value.name).dasherize().s : 'generated-value') + ')' | ||
string += '(' + (value.name.length ? decamelize(value.name, '-') : 'generated-value') + ')' | ||
break; | ||
@@ -235,0 +235,0 @@ default: |
{ | ||
"name": "yargs", | ||
"version": "3.4.0", | ||
"version": "3.4.4", | ||
"description": "Light-weight option parsing with an argv hash. No optstrings attached.", | ||
@@ -12,3 +12,4 @@ "main": "./index.js", | ||
"dependencies": { | ||
"string": "^3.0.0", | ||
"camelcase": "^1.0.2", | ||
"decamelize": "^1.0.0", | ||
"window-size": "0.1.0", | ||
@@ -15,0 +16,0 @@ "wordwrap": "0.0.2" |
@@ -291,9 +291,14 @@ yargs | ||
var argv = require('yargs') | ||
.usage('Count the lines in a file.\nUsage: $0') | ||
.example('$0 -f', 'count the lines in the given file') | ||
.usage('Usage: $0 <command> [options]') | ||
.command('count', 'Count the lines in a file') | ||
.demand(1) | ||
.example('$0 count -f foo.js', 'count the lines in the given file') | ||
.demand('f') | ||
.alias('f', 'file') | ||
.nargs('f', 1) | ||
.describe('f', 'Load a file') | ||
.argv | ||
; | ||
.help('h') | ||
.alias('h', 'help') | ||
.epilog('copyright 2015') | ||
.argv; | ||
@@ -314,19 +319,23 @@ var fs = require('fs'); | ||
*** | ||
$ node line_count.js count | ||
Usage: node test.js <command> [options] | ||
$ node line_count.js | ||
Count the lines in a file. | ||
Usage: node ./line_count.js | ||
Commands: | ||
count Count the lines in a file | ||
Options: | ||
-f, --file Load a file [required] | ||
-h, --help Show help | ||
Examples: | ||
node ./line_count.js -f count the lines in the given file | ||
node test.js count -f foo.js count the lines in the given file | ||
Options: | ||
-f, --file Load a file [required] | ||
copyright 2015 | ||
Missing required arguments: f | ||
$ node line_count.js --file line_count.js | ||
$ node line_count.js count --file line_count.js | ||
20 | ||
$ node line_count.js -f line_count.js | ||
$ node line_count.js count -f line_count.js | ||
20 | ||
@@ -834,6 +843,5 @@ | ||
To run the tests with [expresso](http://github.com/visionmedia/expresso), | ||
just do: | ||
To run the tests with npm, just do: | ||
expresso | ||
npm test | ||
@@ -840,0 +848,0 @@ inspired by |
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
62906
850
4
1161
+ Addedcamelcase@^1.0.2
+ Addeddecamelize@^1.0.0
+ Addedcamelcase@1.2.1(transitive)
+ Addeddecamelize@1.2.0(transitive)
- Removedstring@^3.0.0
- Removedstring@3.3.3(transitive)