yargs 10.0.0-alpha.4 → 10.0.3

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,6 +2,64 @@
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
+ <a name="10.0.3"></a>
6
+ ## [10.0.3](https://github.com/yargs/yargs/compare/v10.0.2...v10.0.3) (2017-10-21)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * parse array rather than string, so that quotes are safe ([#993](https://github.com/yargs/yargs/issues/993)) ([c351685](https://github.com/yargs/yargs/commit/c351685))
12
+
13
+
14
+
15
+ <a name="10.0.2"></a>
16
+ ## [10.0.2](https://github.com/yargs/yargs/compare/v10.0.1...v10.0.2) (2017-10-21)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * fix tiny spacing issue with usage ([#992](https://github.com/yargs/yargs/issues/992)) ([7871327](https://github.com/yargs/yargs/commit/7871327))
22
+
23
+
24
+
25
+ <a name="10.0.1"></a>
26
+ ## [10.0.1](https://github.com/yargs/yargs/compare/v10.0.0...v10.0.1) (2017-10-19)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * help strings for nested commands were missing parent commands ([#990](https://github.com/yargs/yargs/issues/990)) ([cd1ca15](https://github.com/yargs/yargs/commit/cd1ca15))
32
+ * use correct completion command in generated completion script ([#988](https://github.com/yargs/yargs/issues/988)) ([3c8ac1d](https://github.com/yargs/yargs/commit/3c8ac1d))
33
+
34
+
35
+
36
+ <a name="10.0.0"></a>
37
+ # [10.0.0](https://github.com/yargs/yargs/compare/v9.1.0...v10.0.0) (2017-10-18)
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * config and normalize can be disabled with false ([#952](https://github.com/yargs/yargs/issues/952)) ([3bb8771](https://github.com/yargs/yargs/commit/3bb8771))
43
+ * less eager help command execution ([#972](https://github.com/yargs/yargs/issues/972)) ([8c1d7bf](https://github.com/yargs/yargs/commit/8c1d7bf))
44
+ * the positional argument parse was clobbering global flag arguments ([#984](https://github.com/yargs/yargs/issues/984)) ([7e58453](https://github.com/yargs/yargs/commit/7e58453))
45
+
46
+
47
+ ### Features
48
+
49
+ * .usage() can now be used to configure a default command ([#975](https://github.com/yargs/yargs/issues/975)) ([7269531](https://github.com/yargs/yargs/commit/7269531))
50
+ * hidden options are now explicitly indicated using "hidden" flag ([#962](https://github.com/yargs/yargs/issues/962)) ([280d0d6](https://github.com/yargs/yargs/commit/280d0d6))
51
+ * introduce .positional() for configuring positional arguments ([#967](https://github.com/yargs/yargs/issues/967)) ([cb16460](https://github.com/yargs/yargs/commit/cb16460))
52
+ * replace $0 with file basename ([#983](https://github.com/yargs/yargs/issues/983)) ([20bb99b](https://github.com/yargs/yargs/commit/20bb99b))
53
+
54
+
55
+ ### BREAKING CHANGES
56
+
57
+ * .usage() no longer accepts an options object as the second argument. It can instead be used as an alias for configuring a default command.
58
+ * previously hidden options were simply implied using a falsy description
59
+ * help command now only executes if it's the last positional in argv._
60
+
61
+
62
+
5
63
  <a name="9.1.0"></a>
6
64
  # [9.1.0](https://github.com/yargs/yargs/compare/v9.0.1...v9.1.0) (2017-09-25)
7
65
 
package/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Yargs
2
2
 
3
+ _Yargs is developed on evenings and weekends by
4
+ volunteers. Why not grab them dinner or a drink?_
5
+
6
+ [![Support via Gratipay](https://cdn.rawgit.com/gratipay/gratipay-badge/2.3.0/dist/gratipay.svg)](https://gratipay.com/yargs/)
7
+
3
8
  [![Build Status][travis-image]][travis-url]
4
9
  [![Coverage Status][coveralls-image]][coveralls-url]
5
10
  [![NPM version][npm-image]][npm-url]
package/completion.sh.hbs CHANGED
@@ -2,8 +2,8 @@
2
2
  #
3
3
  # yargs command completion script
4
4
  #
5
- # Installation: {{app_path}} completion >> ~/.bashrc
6
- # or {{app_path}} completion >> ~/.bash_profile on OSX.
5
+ # Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
6
+ # or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
7
7
  #
8
8
  _yargs_completions()
9
9
  {
package/lib/command.js CHANGED
@@ -244,7 +244,7 @@ module.exports = function command (yargs, usage, validation) {
244
244
  }
245
245
 
246
246
  function usageFromParentCommandsCommandHandler (parentCommands, commandHandler) {
247
- const c = DEFAULT_MARKER.test(commandHandler.original) ? commandHandler.original.replace(DEFAULT_MARKER, '') : commandHandler.original
247
+ const c = DEFAULT_MARKER.test(commandHandler.original) ? commandHandler.original.replace(DEFAULT_MARKER, '').trim() : commandHandler.original
248
248
  const pc = parentCommands.filter((c) => { return !DEFAULT_MARKER.test(c) })
249
249
  pc.push(c)
250
250
  return `$0 ${pc.join(' ')}`
@@ -318,15 +318,16 @@ module.exports = function command (yargs, usage, validation) {
318
318
 
319
319
  const unparsed = []
320
320
  Object.keys(positionalMap).forEach((key) => {
321
- [].push.apply(unparsed, positionalMap[key].map((value) => {
322
- return `--${key} ${value}`
323
- }))
321
+ positionalMap[key].map((value) => {
322
+ unparsed.push(`--${key}`)
323
+ unparsed.push(value)
324
+ })
324
325
  })
325
326
 
326
327
  // short-circuit parse.
327
328
  if (!unparsed.length) return
328
329
 
329
- const parsed = Parser.detailed(unparsed.join(' '), options)
330
+ const parsed = Parser.detailed(unparsed, options)
330
331
 
331
332
  if (parsed.error) {
332
333
  yargs.getUsageInstance().fail(parsed.error.message, parsed.error)
package/lib/completion.js CHANGED
@@ -78,7 +78,7 @@ module.exports = function completion (yargs, usage, command) {
78
78
  }
79
79
 
80
80
  // generate the completion script to add to your .bashrc.
81
- self.generateCompletionScript = function generateCompletionScript ($0) {
81
+ self.generateCompletionScript = function generateCompletionScript ($0, cmd) {
82
82
  let script = fs.readFileSync(
83
83
  path.resolve(__dirname, '../completion.sh.hbs'),
84
84
  'utf-8'
@@ -89,6 +89,7 @@ module.exports = function completion (yargs, usage, command) {
89
89
  if ($0.match(/\.js$/)) $0 = `./${$0}`
90
90
 
91
91
  script = script.replace(/{{app_name}}/g, name)
92
+ script = script.replace(/{{completion_command}}/g, cmd)
92
93
  return script.replace(/{{app_path}}/g, $0)
93
94
  }
94
95
 
package/lib/usage.js CHANGED
@@ -197,13 +197,16 @@ module.exports = function usage (yargs, y18n) {
197
197
  if (commands.length) {
198
198
  ui.div(__('Commands:'))
199
199
 
200
+ const context = yargs.getContext()
201
+ const parentCommands = context.commands.length ? `${context.commands.join(' ')} ` : ''
202
+
200
203
  commands.forEach((command) => {
201
- const commandString = `${base$0} ${command[0].replace(/^\$0 ?/, '')}` // drop $0 from default commands.
204
+ const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}` // drop $0 from default commands.
202
205
  ui.span(
203
206
  {
204
207
  text: commandString,
205
208
  padding: [0, 2, 0, 2],
206
- width: maxWidth(commands, theWrap, base$0) + 4
209
+ width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4
207
210
  },
208
211
  {text: command[1]}
209
212
  )
package/locales/en.json CHANGED
@@ -36,5 +36,7 @@
36
36
  "Show help": "Show help",
37
37
  "Show version number": "Show version number",
38
38
  "Did you mean %s?": "Did you mean %s?",
39
- "Arguments %s and %s are mutually exclusive" : "Arguments %s and %s are mutually exclusive"
39
+ "Arguments %s and %s are mutually exclusive" : "Arguments %s and %s are mutually exclusive",
40
+ "Positionals:": "Positionals:",
41
+ "command": "command"
40
42
  }
package/locales/hi.json CHANGED
@@ -35,5 +35,8 @@
35
35
  "Path to JSON config file": "JSON config फाइल का पथ",
36
36
  "Show help": "सहायता दिखाएँ",
37
37
  "Show version number": "Version संख्या दिखाएँ",
38
- "Did you mean %s?": "क्या आपका मतलब है %s?"
38
+ "Did you mean %s?": "क्या आपका मतलब है %s?",
39
+ "Arguments %s and %s are mutually exclusive" : "तर्क %s और %s परस्पर अनन्य हैं",
40
+ "Positionals:": "स्थानीय:",
41
+ "command": "आदेश"
39
42
  }
package/locales/id.json CHANGED
@@ -36,5 +36,8 @@
36
36
  "Path to JSON config file": "Alamat berkas konfigurasi JSON",
37
37
  "Show help": "Lihat bantuan",
38
38
  "Show version number": "Lihat nomor versi",
39
- "Did you mean %s?": "Maksud Anda: %s?"
39
+ "Did you mean %s?": "Maksud Anda: %s?",
40
+ "Arguments %s and %s are mutually exclusive" : "Argumen %s dan %s saling eksklusif",
41
+ "Positionals:": "Posisional-posisional:",
42
+ "command": "perintah"
40
43
  }
package/locales/ko.json CHANGED
@@ -35,5 +35,8 @@
35
35
  "Path to JSON config file": "JSON 설정파일 경로",
36
36
  "Show help": "도움말을 보여줍니다",
37
37
  "Show version number": "버전 넘버를 보여줍니다",
38
- "Did you mean %s?": "찾고계신게 %s입니까?"
38
+ "Did you mean %s?": "찾고계신게 %s입니까?",
39
+ "Arguments %s and %s are mutually exclusive" : "%s와 %s 인자는 같이 사용될 수 없습니다",
40
+ "Positionals:": "위치:",
41
+ "command": "명령"
39
42
  }
package/locales/nl.json CHANGED
@@ -35,5 +35,8 @@
35
35
  "Path to JSON config file": "Pad naar JSON configuratiebestand",
36
36
  "Show help": "Toon help",
37
37
  "Show version number": "Toon versie nummer",
38
- "Did you mean %s?": "Bedoelde u misschien %s?"
38
+ "Did you mean %s?": "Bedoelde u misschien %s?",
39
+ "Arguments %s and %s are mutually exclusive": "Argumenten %s en %s zijn onderling uitsluitend",
40
+ "Positionals:": "Positie-afhankelijke argumenten",
41
+ "command": "commando"
39
42
  }
@@ -2,7 +2,7 @@
2
2
  "Commands:": "Comandos:",
3
3
  "Options:": "Opções:",
4
4
  "Examples:": "Exemplos:",
5
- "boolean": "boolean",
5
+ "boolean": "booleano",
6
6
  "count": "contagem",
7
7
  "string": "string",
8
8
  "number": "número",
@@ -36,5 +36,7 @@
36
36
  "Show help": "Exibe ajuda",
37
37
  "Show version number": "Exibe a versão",
38
38
  "Did you mean %s?": "Você quis dizer %s?",
39
- "Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos"
39
+ "Arguments %s and %s are mutually exclusive" : "Argumentos %s e %s são mutualmente exclusivos",
40
+ "Positionals:": "Posicionais:",
41
+ "command": "comando"
40
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yargs",
3
- "version": "10.0.0-alpha.4",
3
+ "version": "10.0.3",
4
4
  "description": "yargs the modern, pirate-themed, successor to optimist.",
5
5
  "main": "./index.js",
6
6
  "files": [
package/yargs.js CHANGED
@@ -861,7 +861,7 @@ function Yargs (processArgs, cwd, parentRequire) {
861
861
  self.showCompletionScript = function ($0) {
862
862
  argsert('[string]', [$0], arguments.length)
863
863
  $0 = $0 || self.$0
864
- _logger.log(completion.generateCompletionScript($0))
864
+ _logger.log(completion.generateCompletionScript($0, completionCommand))
865
865
  return self
866
866
  }
867
867