Comparing version 3.0.4 to 3.1.0
@@ -268,5 +268,5 @@ var path = require('path'); | ||
self.version = function (ver, opt, msg) { | ||
versionOpt = opt; | ||
versionOpt = opt || 'version'; | ||
usage.version(ver); | ||
self.describe(opt, msg || 'Show version number'); | ||
self.describe(versionOpt, msg || 'Show version number'); | ||
return self; | ||
@@ -273,0 +273,0 @@ }; |
@@ -300,3 +300,4 @@ // this file handles outputting usage instructions, | ||
self.showVersion = function() { | ||
console.log(version); | ||
if (typeof version === 'function') console.log(version()); | ||
else console.log(version); | ||
}; | ||
@@ -303,0 +304,0 @@ |
{ | ||
"name": "yargs", | ||
"version": "3.0.4", | ||
"version": "3.1.0", | ||
"description": "Light-weight option parsing with an argv hash. No optstrings attached.", | ||
@@ -29,3 +29,3 @@ "main": "./index.js", | ||
"type": "git", | ||
"url": "http://github.com/chevex/yargs.git" | ||
"url": "http://github.com/bcoe/yargs.git" | ||
}, | ||
@@ -32,0 +32,0 @@ "config": { |
@@ -8,8 +8,8 @@ yargs | ||
[![Build Status](https://travis-ci.org/chevex/yargs.png)](https://travis-ci.org/chevex/yargs) | ||
[![Dependency Status](https://gemnasium.com/chevex/yargs.png)](https://gemnasium.com/chevex/yargs) | ||
[![Build Status](https://travis-ci.org/bcoe/yargs.png)](https://travis-ci.org/bcoe/yargs) | ||
[![Dependency Status](https://gemnasium.com/bcoe/yargs.png)](https://gemnasium.com/bcoe/yargs) | ||
[![NPM version](https://badge.fury.io/js/yargs.png)](http://badge.fury.io/js/yargs) | ||
[![Coverage Status](https://coveralls.io/repos/chevex/yargs/badge.svg?branch=)](https://coveralls.io/r/chevex/yargs?branch=) | ||
[![Coverage Status](https://coveralls.io/repos/bcoe/yargs/badge.svg?branch=)](https://coveralls.io/r/bcoe/yargs?branch=) | ||
> Yargs is the official successor to optimist. Please feel free to submit issues and pull requests. If you'd like to contribute and don't know where to start, have a look at [the issue list](https://github.com/chevex/yargs/issues) :) | ||
> Yargs is the official successor to optimist. Please feel free to submit issues and pull requests. If you'd like to contribute and don't know where to start, have a look at [the issue list](https://github.com/bcoe/yargs/issues) :) | ||
@@ -599,3 +599,3 @@ examples | ||
.version(version, option, [description]) | ||
.version(version, [option], [description]) | ||
---------------------------------------- | ||
@@ -605,4 +605,15 @@ | ||
`version` parameter) and exits the process. If present, the `description` | ||
parameter customises the description of the version option in the usage string. | ||
parameter customizes the description of the version option in the usage string. | ||
You can provide a `function` for version, rather than a string. | ||
This is useful if you want to use the version from your package.json: | ||
```js | ||
var argv = require('yargs') | ||
.version(function() { | ||
return require('../package').version; | ||
}) | ||
.argv; | ||
``` | ||
.showHelpOnFail(enable, [message]) | ||
@@ -751,3 +762,3 @@ ---------------------------------- | ||
git clone http://github.com/chevex/yargs.git | ||
git clone http://github.com/bcoe/yargs.git | ||
@@ -754,0 +765,0 @@ To run the tests with [expresso](http://github.com/visionmedia/expresso), |
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
57045
1052
771