yargs 14.2.3 → 15.1.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/CHANGELOG.md CHANGED
@@ -2,18 +2,70 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- ### 14.2.2
5
+ ## [15.1.0](https://www.github.com/yargs/yargs/compare/v15.0.2...v15.1.0) (2020-01-02)
6
+
7
+
8
+ ### Features
9
+
10
+ * **lang:** add Finnish localization (language code fi) ([222c8fe](https://www.github.com/yargs/yargs/commit/222c8fef2e2ad46e314c337dec96940f896bec35))
11
+ * complete short options with a single dash ([#1507](https://www.github.com/yargs/yargs/issues/1507)) ([99011ab](https://www.github.com/yargs/yargs/commit/99011ab5ba90232506ece0a17e59e2001a1ab562))
12
+ * onFinishCommand handler ([#1473](https://www.github.com/yargs/yargs/issues/1473)) ([fe380cd](https://www.github.com/yargs/yargs/commit/fe380cd356aa33aef0449facd59c22cab8930ac9))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * getCompletion() was not working for options ([#1495](https://www.github.com/yargs/yargs/issues/1495)) ([463feb2](https://www.github.com/yargs/yargs/commit/463feb2870158eb9df670222b0f0a40a05cf18d0))
18
+ * misspelling of package.json `engines` field ([0891d0e](https://www.github.com/yargs/yargs/commit/0891d0ed35b30c83a6d9e9f6a5c5f84d13c546a0))
19
+ * populate positionals when unknown-options-as-args is set ([#1508](https://www.github.com/yargs/yargs/issues/1508)) ([bb0f2eb](https://www.github.com/yargs/yargs/commit/bb0f2eb996fa4e19d330b31a01c2036cafa99a7e)), closes [#1444](https://www.github.com/yargs/yargs/issues/1444)
20
+ * show 2 dashes on help for single digit option key or alias ([#1493](https://www.github.com/yargs/yargs/issues/1493)) ([63b3dd3](https://www.github.com/yargs/yargs/commit/63b3dd31a455d428902220c1992ae930e18aff5c))
21
+ * **docs:** use recommended cjs import syntax for ts examples ([#1513](https://www.github.com/yargs/yargs/issues/1513)) ([f9a18bf](https://www.github.com/yargs/yargs/commit/f9a18bfd624a5013108084f690cd8a1de794c430))
22
+
23
+ ### [15.0.2](https://www.github.com/yargs/yargs/compare/v15.0.1...v15.0.2) (2019-11-19)
24
+
6
25
 
7
26
  ### Bug Fixes
8
27
 
9
28
  * temporary fix for libraries that call Object.freeze() ([#1483](https://www.github.com/yargs/yargs/issues/1483)) ([99c2dc8](https://www.github.com/yargs/yargs/commit/99c2dc850e67c606644f8b0c0bca1a59c87dcbcd))
10
29
 
11
- ### [14.2.1](https://github.com/yargs/yargs/compare/v14.2.0...v14.2.1) (2019-10-30)
30
+ ### [15.0.1](https://www.github.com/yargs/yargs/compare/v15.0.0...v15.0.1) (2019-11-16)
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * **deps:** cliui, find-up, and string-width, all drop Node 6 support ([#1479](https://www.github.com/yargs/yargs/issues/1479)) ([6a9ebe2](https://www.github.com/yargs/yargs/commit/6a9ebe2d955e3e979e76c07ffbb1c17fef64cb49))
36
+
37
+ ## [15.0.0](https://www.github.com/yargs/yargs/compare/v14.2.0...v15.0.0) (2019-11-10)
38
+
39
+
40
+ ### ⚠ BREAKING CHANGES
41
+
42
+ * **deps:** yargs-parser now throws on invalid combinations of config (#1470)
43
+ * yargs-parser@16.0.0 drops support for Node 6
44
+ * drop Node 6 support (#1461)
45
+ * remove package.json-based parserConfiguration (#1460)
46
+
47
+ ### Features
48
+
49
+ * **deps:** yargs-parser now throws on invalid combinations of config ([#1470](https://www.github.com/yargs/yargs/issues/1470)) ([c10c38c](https://www.github.com/yargs/yargs/commit/c10c38cca04298f96b55a7e374a9a134abefffa7))
50
+ * expose `Parser` from `require('yargs/yargs')` ([#1477](https://www.github.com/yargs/yargs/issues/1477)) ([1840ba2](https://www.github.com/yargs/yargs/commit/1840ba22f1a24c0ece8e32bbd31db4134a080aee))
12
51
 
13
52
 
14
53
  ### Bug Fixes
15
54
 
16
- * stop-parse was not being respected by commands ([#1459](https://github.com/yargs/yargs/issues/1459)) ([e78e76e](https://github.com/yargs/yargs/commit/e78e76e3ac0551d4f30c71a05ddb21582960fcef))
55
+ * **docs:** TypeScript import to prevent a future major release warning ([#1441](https://www.github.com/yargs/yargs/issues/1441)) ([b1b156a](https://www.github.com/yargs/yargs/commit/b1b156a3eb4ddd6803fbbd56c611a77919293000))
56
+ * stop-parse was not being respected by commands ([#1459](https://www.github.com/yargs/yargs/issues/1459)) ([12c82e6](https://www.github.com/yargs/yargs/commit/12c82e62663e928148a7ee2f51629aa26a0f9bb2))
57
+ * update to yargs-parser with fix for array default values ([#1463](https://www.github.com/yargs/yargs/issues/1463)) ([ebee59d](https://www.github.com/yargs/yargs/commit/ebee59d9022da538410e69a5c025019ed46d13d2))
58
+ * **docs:** update boolean description and examples in docs ([#1474](https://www.github.com/yargs/yargs/issues/1474)) ([afd5b48](https://www.github.com/yargs/yargs/commit/afd5b4871bfeb90d58351ac56c5c44a83ef033e6))
59
+
60
+
61
+ ### Miscellaneous Chores
62
+
63
+ * drop Node 6 support ([#1461](https://www.github.com/yargs/yargs/issues/1461)) ([2ba8ce0](https://www.github.com/yargs/yargs/commit/2ba8ce05e8fefbeffc6cb7488d9ebf6e86cceb1d))
64
+
65
+
66
+ ### Code Refactoring
67
+
68
+ * remove package.json-based parserConfiguration ([#1460](https://www.github.com/yargs/yargs/issues/1460)) ([0d3642b](https://www.github.com/yargs/yargs/commit/0d3642b6f829b637938774c0c6ce5f6bfe1afa51))
17
69
 
18
70
  ## [14.2.0](https://github.com/yargs/yargs/compare/v14.1.0...v14.2.0) (2019-10-07)
19
71
 
package/README.md CHANGED
@@ -98,6 +98,10 @@ npm i @types/yargs --save-dev
98
98
 
99
99
  See usage examples in [docs](/docs/typescript.md).
100
100
 
101
+ ## Webpack
102
+
103
+ See usage examples of yargs with webpack in [docs](/docs/webpack.md).
104
+
101
105
  ## Community :
102
106
 
103
107
  Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com).
package/lib/command.js CHANGED
@@ -79,7 +79,7 @@ module.exports = function command (yargs, usage, validation, globalMiddleware) {
79
79
  description: description,
80
80
  handler,
81
81
  builder: builder || {},
82
- middlewares: middlewares || [],
82
+ middlewares,
83
83
  demanded: parsedCommand.demanded,
84
84
  optional: parsedCommand.optional
85
85
  }
@@ -218,7 +218,7 @@ module.exports = function command (yargs, usage, validation, globalMiddleware) {
218
218
  positionalMap = populatePositionals(commandHandler, innerArgv, currentContext, yargs)
219
219
  }
220
220
 
221
- const middlewares = globalMiddleware.slice(0).concat(commandHandler.middlewares || [])
221
+ const middlewares = globalMiddleware.slice(0).concat(commandHandler.middlewares)
222
222
  applyMiddleware(innerArgv, yargs, middlewares, true)
223
223
 
224
224
  // we apply validation post-hoc, so that custom
@@ -240,15 +240,26 @@ module.exports = function command (yargs, usage, validation, globalMiddleware) {
240
240
  handlerResult = commandHandler.handler(innerArgv)
241
241
  }
242
242
 
243
+ const handlerFinishCommand = yargs.getHandlerFinishCommand()
243
244
  if (isPromise(handlerResult)) {
244
245
  yargs.getUsageInstance().cacheHelpMessage()
245
- handlerResult.catch(error => {
246
- try {
247
- yargs.getUsageInstance().fail(null, error)
248
- } catch (err) {
246
+ handlerResult
247
+ .then(value => {
248
+ if (handlerFinishCommand) {
249
+ handlerFinishCommand(value)
250
+ }
251
+ })
252
+ .catch(error => {
253
+ try {
254
+ yargs.getUsageInstance().fail(null, error)
255
+ } catch (err) {
249
256
  // fail's throwing would cause an unhandled rejection.
250
- }
251
- })
257
+ }
258
+ })
259
+ } else {
260
+ if (handlerFinishCommand) {
261
+ handlerFinishCommand(handlerResult)
262
+ }
252
263
  }
253
264
  }
254
265
 
@@ -344,6 +355,7 @@ module.exports = function command (yargs, usage, validation, globalMiddleware) {
344
355
  const unparsed = []
345
356
  Object.keys(positionalMap).forEach((key) => {
346
357
  positionalMap[key].map((value) => {
358
+ if (options.configuration['unknown-options-as-args']) options.key[key] = true
347
359
  unparsed.push(`--${key}`)
348
360
  unparsed.push(value)
349
361
  })
package/lib/completion.js CHANGED
@@ -8,6 +8,11 @@ module.exports = function completion (yargs, usage, command) {
8
8
  completionKey: 'get-yargs-completions'
9
9
  }
10
10
 
11
+ let aliases
12
+ self.setParsed = function setParsed (parsed) {
13
+ aliases = parsed.aliases
14
+ }
15
+
11
16
  const zshShell = (process.env.SHELL && process.env.SHELL.indexOf('zsh') !== -1) ||
12
17
  (process.env.ZSH_NAME && process.env.ZSH_NAME.indexOf('zsh') !== -1)
13
18
  // get a list of completion commands.
@@ -16,7 +21,6 @@ module.exports = function completion (yargs, usage, command) {
16
21
  const completions = []
17
22
  const current = args.length ? args[args.length - 1] : ''
18
23
  const argv = yargs.parse(args, true)
19
- const aliases = yargs.parsed.aliases
20
24
  const parentCommands = yargs.getContext().commands
21
25
 
22
26
  // a custom completion function can be provided
@@ -77,11 +81,14 @@ module.exports = function completion (yargs, usage, command) {
77
81
  const keyAndAliases = [key].concat(aliases[key] || [])
78
82
  const notInArgs = keyAndAliases.every(val => args.indexOf(`--${val}`) === -1)
79
83
  if (notInArgs) {
84
+ const startsByTwoDashes = s => /^--/.test(s)
85
+ const isShortOption = s => /^[^0-9]$/.test(s)
86
+ const dashes = !startsByTwoDashes(current) && isShortOption(key) ? '-' : '--'
80
87
  if (!zshShell) {
81
- completions.push(`--${key}`)
88
+ completions.push(dashes + key)
82
89
  } else {
83
90
  const desc = descs[key] || ''
84
- completions.push(`--${key.replace(/:/g, '\\:')}:${desc.replace('__yargsString__:', '')}`)
91
+ completions.push(dashes + `${key.replace(/:/g, '\\:')}:${desc.replace('__yargsString__:', '')}`)
85
92
  }
86
93
  }
87
94
  })
package/lib/usage.js CHANGED
@@ -272,7 +272,7 @@ module.exports = function usage (yargs, y18n) {
272
272
  // for the special positional group don't
273
273
  // add '--' or '-' prefix.
274
274
  if (groupName === self.getPositionalGroupName()) return sw
275
- else return (sw.length > 1 ? '--' : '-') + sw
275
+ else return (/^[^0-9]$/.test(sw) ? '-' : '--') + sw
276
276
  })
277
277
  .join(', ')
278
278
 
@@ -0,0 +1,42 @@
1
+ {
2
+ "Commands:": "Komennot:",
3
+ "Options:": "Valinnat:",
4
+ "Examples:": "Esimerkkejä:",
5
+ "boolean": "totuusarvo",
6
+ "count": "lukumäärä",
7
+ "string": "merkkijono",
8
+ "number": "numero",
9
+ "array": "taulukko",
10
+ "required": "pakollinen",
11
+ "default:": "oletusarvo:",
12
+ "choices:": "vaihtoehdot:",
13
+ "aliases:": "aliakset:",
14
+ "generated-value": "generoitu-arvo",
15
+ "Not enough non-option arguments: got %s, need at least %s": "Liian vähän argumentteja, jotka eivät ole valintoja: annettu %s, vaaditaan vähintään %s",
16
+ "Too many non-option arguments: got %s, maximum of %s": "Liikaa argumentteja, jotka eivät ole valintoja: annettu %s, sallitaan enintään %s",
17
+ "Missing argument value: %s": {
18
+ "one": "Argumentin arvo puuttuu: %s",
19
+ "other": "Argumentin arvot puuttuvat: %s"
20
+ },
21
+ "Missing required argument: %s": {
22
+ "one": "Pakollinen argumentti puuttuu: %s",
23
+ "other": "Pakollisia argumentteja puuttuu: %s"
24
+ },
25
+ "Unknown argument: %s": {
26
+ "one": "Tuntematon argumenttn: %s",
27
+ "other": "Tuntemattomia argumentteja: %s"
28
+ },
29
+ "Invalid values:": "Virheelliset arvot:",
30
+ "Argument: %s, Given: %s, Choices: %s": "Argumentti: %s, Annettu: %s, Vaihtoehdot: %s",
31
+ "Argument check failed: %s": "Argumentin tarkistus epäonnistui: %s",
32
+ "Implications failed:": "Riippuvia argumentteja puuttuu:",
33
+ "Not enough arguments following: %s": "Argumentin perässä ei ole tarpeeksi argumentteja: %s",
34
+ "Invalid JSON config file: %s": "Epävalidi JSON-asetustiedosto: %s",
35
+ "Path to JSON config file": "JSON-asetustiedoston polku",
36
+ "Show help": "Näytä ohje",
37
+ "Show version number": "Näytä versionumero",
38
+ "Did you mean %s?": "Tarkoititko %s?",
39
+ "Arguments %s and %s are mutually exclusive" : "Argumentit %s ja %s eivät ole yhteensopivat",
40
+ "Positionals:": "Sijaintiparametrit:",
41
+ "command": "komento"
42
+ }
package/locales/fr.json CHANGED
@@ -33,5 +33,6 @@
33
33
  "Invalid JSON config file: %s": "Fichier de configuration JSON invalide: %s",
34
34
  "Path to JSON config file": "Chemin du fichier de configuration JSON",
35
35
  "Show help": "Affiche de l'aide",
36
- "Show version number": "Affiche le numéro de version"
36
+ "Show version number": "Affiche le numéro de version",
37
+ "Arguments %s and %s are mutually exclusive" : "Les arguments %s et %s sont mutuellement exclusifs"
37
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yargs",
3
- "version": "14.2.3",
3
+ "version": "15.1.0",
4
4
  "description": "yargs the modern, pirate-themed, successor to optimist.",
5
5
  "main": "./index.js",
6
6
  "contributors": [
@@ -19,19 +19,20 @@
19
19
  "LICENSE"
20
20
  ],
21
21
  "dependencies": {
22
- "cliui": "^5.0.0",
22
+ "cliui": "^6.0.0",
23
23
  "decamelize": "^1.2.0",
24
- "find-up": "^3.0.0",
24
+ "find-up": "^4.1.0",
25
25
  "get-caller-file": "^2.0.1",
26
26
  "require-directory": "^2.1.1",
27
27
  "require-main-filename": "^2.0.0",
28
28
  "set-blocking": "^2.0.0",
29
- "string-width": "^3.0.0",
29
+ "string-width": "^4.2.0",
30
30
  "which-module": "^2.0.0",
31
31
  "y18n": "^4.0.0",
32
- "yargs-parser": "^15.0.1"
32
+ "yargs-parser": "^16.1.0"
33
33
  },
34
34
  "devDependencies": {
35
+ "c8": "^6.0.1",
35
36
  "chai": "^4.2.0",
36
37
  "chalk": "^2.4.2",
37
38
  "coveralls": "^3.0.3",
@@ -40,18 +41,16 @@
40
41
  "es6-promise": "^4.2.5",
41
42
  "hashish": "0.0.4",
42
43
  "mocha": "^5.2.0",
43
- "nyc": "^14.1.0",
44
44
  "rimraf": "^2.6.3",
45
45
  "standard": "^12.0.1",
46
- "standard-version": "^7.0.0",
47
46
  "which": "^1.3.1",
48
47
  "yargs-test-extends": "^1.0.1"
49
48
  },
50
49
  "scripts": {
51
- "pretest": "standard",
52
- "test": "nyc --cache mocha --require ./test/before.js --timeout=12000 --check-leaks",
53
- "coverage": "nyc report --reporter=text-lcov | coveralls",
54
- "release": "standard-version"
50
+ "fix": "standard --fix",
51
+ "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"
55
54
  },
56
55
  "repository": {
57
56
  "type": "git",
@@ -73,7 +72,7 @@
73
72
  "command"
74
73
  ],
75
74
  "license": "MIT",
76
- "engine": {
77
- "node": ">=6"
75
+ "engines": {
76
+ "node": ">=8"
78
77
  }
79
78
  }
package/yargs.js CHANGED
@@ -1,4 +1,9 @@
1
1
  'use strict'
2
+
3
+ // an async function fails early in Node.js versions prior to 8.
4
+ async function requiresNode8OrGreater () {}
5
+ requiresNode8OrGreater()
6
+
2
7
  const argsert = require('./lib/argsert')
3
8
  const fs = require('fs')
4
9
  const Command = require('./lib/command')
@@ -27,6 +32,7 @@ function Yargs (processArgs, cwd, parentRequire) {
27
32
  let preservedGroups = {}
28
33
  let usage = null
29
34
  let validation = null
35
+ let handlerFinishCommand = null
30
36
 
31
37
  const y18n = Y18n({
32
38
  directory: path.resolve(__dirname, './locales'),
@@ -167,6 +173,7 @@ function Yargs (processArgs, cwd, parentRequire) {
167
173
  frozen.parsed = self.parsed
168
174
  frozen.parseFn = parseFn
169
175
  frozen.parseContext = parseContext
176
+ frozen.handlerFinishCommand = handlerFinishCommand
170
177
  }
171
178
  function unfreeze () {
172
179
  let frozen = frozens.pop()
@@ -185,6 +192,7 @@ function Yargs (processArgs, cwd, parentRequire) {
185
192
  completionCommand = frozen.completionCommand
186
193
  parseFn = frozen.parseFn
187
194
  parseContext = frozen.parseContext
195
+ handlerFinishCommand = frozen.handlerFinishCommand
188
196
  }
189
197
 
190
198
  self.boolean = function (keys) {
@@ -238,7 +246,6 @@ function Yargs (processArgs, cwd, parentRequire) {
238
246
  function populateParserHintArray (type, keys, value) {
239
247
  keys = [].concat(keys)
240
248
  keys.forEach((key) => {
241
- key = sanitizeKey(key)
242
249
  options[type].push(key)
243
250
  })
244
251
  }
@@ -294,8 +301,8 @@ function Yargs (processArgs, cwd, parentRequire) {
294
301
 
295
302
  function populateParserHintObject (builder, isArray, type, key, value) {
296
303
  if (Array.isArray(key)) {
297
- const temp = Object.create(null)
298
304
  // an array of keys with one value ['x', 'y', 'z'], function parse () {}
305
+ const temp = {}
299
306
  key.forEach((k) => {
300
307
  temp[k] = value
301
308
  })
@@ -306,7 +313,6 @@ function Yargs (processArgs, cwd, parentRequire) {
306
313
  builder(k, key[k])
307
314
  })
308
315
  } else {
309
- key = sanitizeKey(key)
310
316
  // a single key value pair 'x', parse() {}
311
317
  if (isArray) {
312
318
  options[type][key] = (options[type][key] || []).concat(value)
@@ -316,13 +322,6 @@ function Yargs (processArgs, cwd, parentRequire) {
316
322
  }
317
323
  }
318
324
 
319
- // TODO(bcoe): in future major versions move more objects towards
320
- // Object.create(null):
321
- function sanitizeKey (key) {
322
- if (key === '__proto__') return '___proto___'
323
- return key
324
- }
325
-
326
325
  function deleteFromParserHintObject (optionKey) {
327
326
  // delete from all parsing hints:
328
327
  // boolean, array, key, alias, etc.
@@ -487,6 +486,14 @@ function Yargs (processArgs, cwd, parentRequire) {
487
486
  return self
488
487
  }
489
488
 
489
+ self.onFinishCommand = function (f) {
490
+ argsert('<function>', [f], arguments.length)
491
+ handlerFinishCommand = f
492
+ return self
493
+ }
494
+
495
+ self.getHandlerFinishCommand = () => handlerFinishCommand
496
+
490
497
  self.check = function (f, _global) {
491
498
  argsert('<function> [boolean]', [f, _global], arguments.length)
492
499
  validation.check(f, _global !== false)
@@ -585,6 +592,7 @@ function Yargs (processArgs, cwd, parentRequire) {
585
592
  if (parseFn) exitProcess = false
586
593
 
587
594
  const parsed = self._parseArgs(args, shortCircuit)
595
+ completion.setParsed(self.parsed)
588
596
  if (parseFn) parseFn(exitError, parsed, output)
589
597
  unfreeze()
590
598
 
@@ -612,7 +620,7 @@ function Yargs (processArgs, cwd, parentRequire) {
612
620
 
613
621
  const demand = opt.demand || opt.required || opt.require
614
622
 
615
- // deprecated, use 'demandOption' instead
623
+ // A required option can be specified via "demand: true".
616
624
  if (demand) {
617
625
  self.demand(key, demand)
618
626
  }
@@ -1040,12 +1048,6 @@ function Yargs (processArgs, cwd, parentRequire) {
1040
1048
 
1041
1049
  options.__ = y18n.__
1042
1050
  options.configuration = self.getParserConfiguration()
1043
- // Deprecated
1044
- let pkgConfig = pkgUp()['yargs']
1045
- if (pkgConfig) {
1046
- console.warn('Configuring yargs through package.json is deprecated and will be removed in a future major release, please use the JS API instead.')
1047
- options.configuration = Object.assign({}, pkgConfig, options.configuration)
1048
- }
1049
1051
 
1050
1052
  const populateDoubleDash = !!options.configuration['populate--']
1051
1053
  const config = Object.assign({}, options.configuration, {
@@ -1213,7 +1215,7 @@ function Yargs (processArgs, cwd, parentRequire) {
1213
1215
  }
1214
1216
 
1215
1217
  self._runValidation = function runValidation (argv, aliases, positionalMap, parseErrors) {
1216
- if (parseErrors) throw new YError(parseErrors.message || parseErrors)
1218
+ if (parseErrors) throw new YError(parseErrors.message)
1217
1219
  validation.nonOptionCount(argv)
1218
1220
  validation.requiredArguments(argv)
1219
1221
  if (strict) validation.unknownArguments(argv, aliases, positionalMap)
@@ -1225,15 +1227,8 @@ function Yargs (processArgs, cwd, parentRequire) {
1225
1227
 
1226
1228
  function guessLocale () {
1227
1229
  if (!detectLocale) return
1228
-
1229
- try {
1230
- const { env } = process
1231
- const locale = env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE || 'en_US'
1232
- self.locale(locale.replace(/[.:].*/, ''))
1233
- } catch (err) {
1234
- // if we explode looking up locale just noop
1235
- // we'll keep using the default language 'en'.
1236
- }
1230
+ const locale = process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || process.env.LANGUAGE || 'en_US'
1231
+ self.locale(locale.replace(/[.:].*/, ''))
1237
1232
  }
1238
1233
 
1239
1234
  // an app should almost always have --version and --help,
@@ -1244,6 +1239,9 @@ function Yargs (processArgs, cwd, parentRequire) {
1244
1239
  return self
1245
1240
  }
1246
1241
 
1242
+ // allow consumers to directly use the version of yargs-parser used by yargs
1243
+ exports.Parser = Parser
1244
+
1247
1245
  // rebase an absolute path to a relative one with respect to a base directory
1248
1246
  // exported for tests
1249
1247
  exports.rebase = rebase