yargs 15.2.0-beta.2 → 15.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,9 +9,9 @@
9
9
  <br>
10
10
 
11
11
  [![Build Status][travis-image]][travis-url]
12
- [![Coverage Status][coveralls-image]][coveralls-url]
13
12
  [![NPM version][npm-image]][npm-url]
14
13
  [![js-standard-style][standard-image]][standard-url]
14
+ [![Coverage][coverage-image]][coverage-url]
15
15
  [![Conventional Commits][conventional-commits-image]][conventional-commits-url]
16
16
  [![Slack][slack-image]][slack-url]
17
17
 
@@ -127,8 +127,6 @@ Having problems? want to contribute? join our [community slack](http://devtoolsc
127
127
 
128
128
  [travis-url]: https://travis-ci.org/yargs/yargs
129
129
  [travis-image]: https://img.shields.io/travis/yargs/yargs/master.svg
130
- [coveralls-url]: https://coveralls.io/github/yargs/yargs
131
- [coveralls-image]: https://img.shields.io/coveralls/yargs/yargs.svg
132
130
  [npm-url]: https://www.npmjs.com/package/yargs
133
131
  [npm-image]: https://img.shields.io/npm/v/yargs.svg
134
132
  [standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
@@ -138,3 +136,5 @@ Having problems? want to contribute? join our [community slack](http://devtoolsc
138
136
  [slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg
139
137
  [slack-url]: http://devtoolscommunity.herokuapp.com
140
138
  [type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs
139
+ [coverage-image]: https://img.shields.io/badge/dynamic/json?color=brightgreen&label=coverage&query=branches&suffix=%25&url=https%3A%2F%2Fraw.githubusercontent.com%2Fyargs%2Fyargs%2Fmaster%2F.nycrc&cacheSeconds=3600
140
+ [coverage-url]: https://github.com/yargs/yargs/blob/master/.nycrc
package/lib/usage.js CHANGED
@@ -273,7 +273,15 @@ module.exports = function usage (yargs, y18n) {
273
273
  // for the special positional group don't
274
274
  // add '--' or '-' prefix.
275
275
  if (groupName === self.getPositionalGroupName()) return sw
276
- else return (/^[^0-9]$/.test(sw) ? '-' : '--') + sw
276
+ else {
277
+ return (
278
+ // matches yargs-parser logic in which single-digits
279
+ // aliases declared with a boolean type are now valid
280
+ /^[0-9]$/.test(sw)
281
+ ? ~options.boolean.indexOf(key) ? '-' : '--'
282
+ : sw.length > 1 ? '--' : '-'
283
+ ) + sw
284
+ }
277
285
  })
278
286
  .join(', ')
279
287
 
@@ -500,6 +508,8 @@ module.exports = function usage (yargs, y18n) {
500
508
  // guess the width of the console window, max-width 80.
501
509
  function windowWidth () {
502
510
  const maxWidth = 80
511
+ // CI is not a TTY
512
+ /* c8 ignore next 2 */
503
513
  if (typeof process === 'object' && process.stdout && process.stdout.columns) {
504
514
  return Math.min(maxWidth, process.stdout.columns)
505
515
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yargs",
3
- "version": "15.2.0-beta.2",
3
+ "version": "15.3.0",
4
4
  "description": "yargs the modern, pirate-themed, successor to optimist.",
5
5
  "main": "./index.js",
6
6
  "contributors": [
@@ -29,13 +29,12 @@
29
29
  "string-width": "^4.2.0",
30
30
  "which-module": "^2.0.0",
31
31
  "y18n": "^4.0.0",
32
- "yargs-parser": "^17.1.0"
32
+ "yargs-parser": "^18.1.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "c8": "^7.0.0",
36
36
  "chai": "^4.2.0",
37
37
  "chalk": "^3.0.0",
38
- "coveralls": "^3.0.3",
39
38
  "cpr": "^3.0.1",
40
39
  "cross-spawn": "^7.0.0",
41
40
  "es6-promise": "^4.2.5",
@@ -49,8 +48,8 @@
49
48
  "scripts": {
50
49
  "fix": "standard --fix",
51
50
  "posttest": "standard",
52
- "test": "c8 --reporter=html --reporter=text mocha --require ./test/before.js --timeout=12000 --check-leaks",
53
- "coverage": "c8 report --reporter=text-lcov | coveralls"
51
+ "test": "c8 mocha --require ./test/before.js --timeout=12000 --check-leaks",
52
+ "coverage": "c8 report --check-coverage"
54
53
  },
55
54
  "repository": {
56
55
  "type": "git",
package/yargs.js CHANGED
@@ -235,9 +235,18 @@ function Yargs (processArgs, cwd, parentRequire) {
235
235
  return self
236
236
  }
237
237
 
238
- self.requiresArg = function (keys) {
239
- argsert('<array|string>', [keys], arguments.length)
240
- populateParserHintObject(self.nargs, false, 'narg', keys, 1)
238
+ self.requiresArg = function (keys, value) {
239
+ argsert('<array|string|object> [number]', [keys], arguments.length)
240
+ // If someone configures nargs at the same time as requiresArg,
241
+ // nargs should take precedent,
242
+ // see: https://github.com/yargs/yargs/pull/1572
243
+ // TODO: make this work with aliases, using a check similar to
244
+ // checkAllAliases() in yargs-parser.
245
+ if (typeof keys === 'string' && options.narg[keys]) {
246
+ return self
247
+ } else {
248
+ populateParserHintObject(self.requiresArg, false, 'narg', keys, NaN)
249
+ }
241
250
  return self
242
251
  }
243
252