Skip to content

Commit

Permalink
fix cherry-picked conflict in index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lrlna committed Feb 14, 2016
1 parent 92e9dc6 commit 4284145
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function Argv (processArgs, cwd) {

var arrayOptions = [
'array', 'boolean', 'string', 'requiresArg',
'count', 'requiresArg', 'count', 'normalize'
'count', 'requiresArg', 'count', 'normalize', 'number'
]

var objectOptions = [
Expand Down Expand Up @@ -132,6 +132,11 @@ function Argv (processArgs, cwd) {
return self
}

self.number = function (numbers) {
options.numbers.push.apply(options.number, [].concat(numbers))
return self
}

self.choices = function (key, values) {
if (typeof key === 'object') {
Object.keys(key).forEach(function (k) {
Expand Down
2 changes: 2 additions & 0 deletions lib/usage.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ module.exports = function (yargs, y18n) {
if (~options.string.indexOf(key)) type = '[' + __('string') + ']'
if (~options.normalize.indexOf(key)) type = '[' + __('string') + ']'
if (~options.array.indexOf(key)) type = '[' + __('array') + ']'
if (~options.number.indexOf(key)) type = '[' + __('number') + ']'

var extra = [
type,
Expand Down Expand Up @@ -290,6 +291,7 @@ module.exports = function (yargs, y18n) {
if (~options.string.indexOf(alias)) yargs.string(key)
if (~options.normalize.indexOf(alias)) yargs.normalize(key)
if (~options.array.indexOf(alias)) yargs.array(key)
if (~options.number.indexOf(alias)) yargs.number(key)
})
})
}
Expand Down
1 change: 1 addition & 0 deletions test/yargs.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ describe('yargs dsl tests', function () {
requiresArg: [],
count: [],
normalize: [],
number: [],
config: {},
envPrefix: undefined,
global: ['help'],
Expand Down

0 comments on commit 4284145

Please sign in to comment.