You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

364 lines
11 KiB

  1. # node-dashdash changelog
  2. ## not yet released
  3. (nothing yet)
  4. ## 1.14.1
  5. - [issue #30] Change the output used by dashdash's Bash completion support to
  6. indicate "there are no completions for this argument" to cope with different
  7. sorting rules on different Bash/platforms. For example:
  8. $ triton -v -p test2 package get <TAB> # before
  9. ##-no -tritonpackage- completions-##
  10. $ triton -v -p test2 package get <TAB> # after
  11. ##-no-completion- -results-##
  12. ## 1.14.0
  13. - New `synopsisFromOpt(<option spec>)` function. This will be used by
  14. [node-cmdln](https://github.com/trentm/node-cmdln) to put together a synopsis
  15. of options for a command. Some examples:
  16. > synopsisFromOpt({names: ['help', 'h'], type: 'bool'});
  17. '[ --help | -h ]'
  18. > synopsisFromOpt({name: 'file', type: 'string', helpArg: 'FILE'});
  19. '[ --file=FILE ]'
  20. ## 1.13.1
  21. - [issue #20] `bashCompletionSpecFromOptions` breaks on an options array with
  22. an empty-string group.
  23. ## 1.13.0
  24. - Update assert-plus dep to 1.x to get recent fixes (particularly for
  25. `assert.optional*`).
  26. - Drop testing (and official support in packages.json#engines) for node 0.8.x.
  27. Add testing against node 5.x and 4.x with `make testall`.
  28. - [pull #16] Change the `positiveInteger` type to NOT accept zero (0).
  29. For those who might need the old behaviour, see
  30. "examples/custom-option-intGteZero.js". (By Dave Pacheco.)
  31. ## 1.12.2
  32. - Bash completion: Add `argtypes` to specify the types of positional args.
  33. E.g. this would allow you to have an `ssh` command with `argtypes = ['host',
  34. 'cmd']` for bash completion. You then have to provide Bash functions to
  35. handle completing those types via the `specExtra` arg. See
  36. "[examples/ddcompletion.js](examples/ddcompletion.js)" for an example.
  37. - Bash completion: Tweak so that options or only offered as completions when
  38. there is a leading '-'. E.g. `mytool <TAB>` does NOT offer options, `mytool
  39. -<TAB>` *does*. Without this, a tool with options would never be able to
  40. fallback to Bash's "default" completion. For example `ls <TAB>` wouldn't
  41. result in filename completion. Now it will.
  42. - Bash completion: A workaround for not being able to explicitly have *no*
  43. completion results. Because dashdash's completion uses `complete -o default`,
  44. we fallback to Bash's "default" completion (typically for filename
  45. completion). Before this change, an attempt to explicitly say "there are
  46. no completions that match" would unintentionally trigger filename completion.
  47. Instead as a workaround we return:
  48. $ ddcompletion --none <TAB> # the 'none' argtype
  49. ##-no completions-##
  50. $ ddcompletion # a custom 'fruit' argtype
  51. apple banana orange
  52. $ ddcompletion z
  53. ##-no -fruit- completions-##
  54. This is a bit of a hack, but IMO a better experience than the surprise
  55. of matching a local filename beginning with 'z', which isn't, in this
  56. case, a "fruit".
  57. ## 1.12.1
  58. - Bash completion: Document `<option spec>.completionType`. Add `includeHidden`
  59. option to `bashCompletionSpecFromOptions()`. Add support for dealing with
  60. hidden subcmds.
  61. ## 1.12.0
  62. - Support for generating Bash completion files. See the "Bash completion"
  63. section of the README.md and "examples/ddcompletion.js" for an example.
  64. ## 1.11.0
  65. - Add the `arrayFlatten` boolean option to `dashdash.addOptionType` used for
  66. custom option types. This allows one to create an `arrayOf...` option type
  67. where each usage of the option can return multiple results. For example:
  68. node mytool.js --foo a,b --foo c
  69. We could define an option type for `--foo` such that
  70. `opts.foo = ['a', 'b', 'c']`. See
  71. "[examples/custom-option-arrayOfCommaSepString.js](examples/custom-option-arrayOfCommaSepString.js)"
  72. for an example.
  73. ## 1.10.1
  74. - Trim the published package to the minimal bits. Before: 24K tarball, 144K unpacked.
  75. After: 12K tarball, 48K unpacked. `npm` won't let me drop the README.md. :)
  76. ## 1.10.0
  77. - [issue #9] Support `includeDefault` in help config (similar to `includeEnv`) to have a
  78. note of an option's default value, if any, in help output.
  79. - [issue #11] Fix option group breakage introduced in v1.9.0.
  80. ## 1.9.0
  81. - [issue #10] Custom option types added with `addOptionType` can specify a
  82. "default" value. See "examples/custom-option-fruit.js".
  83. ## 1.8.0
  84. - Support `hidden: true` in an option spec to have help output exclude this
  85. option.
  86. ## 1.7.3
  87. - [issue #8] Fix parsing of a short option group when one of the
  88. option takes an argument. For example, consider `tail` with
  89. a `-f` boolean option and a `-n` option that takes a number
  90. argument. This should parse:
  91. tail -fn5
  92. Before this change, that would not parse correctly.
  93. It is suspected that this was introduced in version 1.4.0
  94. (with commit 656fa8bc71c372ebddad0a7026bd71611e2ec99a).
  95. ## 1.7.2
  96. - Known issues: #8
  97. - Exclude 'tools/' dir in packages published to npm.
  98. ## 1.7.1
  99. - Known issues: #8
  100. - Support an option group *empty string* value:
  101. ...
  102. { group: '' },
  103. ...
  104. to render as a blank line in option help. This can help separate loosely
  105. related sets of options without resorting to a title for option groups.
  106. ## 1.7.0
  107. - Known issues: #8
  108. - [pull #7] Support for `<parser>.help({helpWrap: false, ...})` option to be able
  109. to fully control the formatting for option help (by Patrick Mooney) `helpWrap:
  110. false` can also be set on individual options in the option objects, e.g.:
  111. var options = [
  112. {
  113. names: ['foo'],
  114. type: 'string',
  115. helpWrap: false,
  116. help: 'long help with\n newlines' +
  117. '\n spaces\n and such\nwill render correctly'
  118. },
  119. ...
  120. ];
  121. ## 1.6.0
  122. - Known issues: #8
  123. - [pull #6] Support headings between groups of options (by Joshua M. Clulow)
  124. so that this code:
  125. var options = [
  126. { group: 'Armament Options' },
  127. { names: [ 'weapon', 'w' ], type: 'string' },
  128. { group: 'General Options' },
  129. { names: [ 'help', 'h' ], type: 'bool' }
  130. ];
  131. ...
  132. will give you this help output:
  133. ...
  134. Armament Options:
  135. -w, --weapon
  136. General Options:
  137. -h, --help
  138. ...
  139. ## 1.5.0
  140. - Known issues: #8
  141. - Add support for adding custom option types. "examples/custom-option-duration.js"
  142. shows an example adding a "duration" option type.
  143. $ node custom-option-duration.js -t 1h
  144. duration: 3600000 ms
  145. $ node custom-option-duration.js -t 1s
  146. duration: 1000 ms
  147. $ node custom-option-duration.js -t 5d
  148. duration: 432000000 ms
  149. $ node custom-option-duration.js -t bogus
  150. custom-option-duration.js: error: arg for "-t" is not a valid duration: "bogus"
  151. A custom option type is added via:
  152. var dashdash = require('dashdash');
  153. dashdash.addOptionType({
  154. name: '...',
  155. takesArg: true,
  156. helpArg: '...',
  157. parseArg: function (option, optstr, arg) {
  158. ...
  159. }
  160. });
  161. - [issue #4] Add `date` and `arrayOfDate` option types. They accept these date
  162. formats: epoch second times (e.g. 1396031701) and ISO 8601 format:
  163. `YYYY-MM-DD[THH:MM:SS[.sss][Z]]` (e.g. "2014-03-28",
  164. "2014-03-28T18:35:01.489Z"). See "examples/date.js" for an example usage.
  165. $ node examples/date.js -s 2014-01-01 -e $(date +%s)
  166. start at 2014-01-01T00:00:00.000Z
  167. end at 2014-03-29T04:26:18.000Z
  168. ## 1.4.0
  169. - Known issues: #8
  170. - [pull #2, pull #3] Add a `allowUnknown: true` option on `createParser` to
  171. allow unknown options to be passed through as `opts._args` instead of parsing
  172. throwing an exception (by https://github.com/isaacs).
  173. See 'allowUnknown' in the README for a subtle caveat.
  174. ## 1.3.2
  175. - Fix a subtlety where a *bool* option using both `env` and `default` didn't
  176. work exactly correctly. If `default: false` then all was fine (by luck).
  177. However, if you had an option like this:
  178. options: [ {
  179. names: ['verbose', 'v'],
  180. env: 'FOO_VERBOSE',
  181. 'default': true, // <--- this
  182. type: 'bool'
  183. } ],
  184. wanted `FOO_VERBOSE=0` to make the option false, then you need the fix
  185. in this version of dashdash.
  186. ## 1.3.1
  187. - [issue #1] Fix an envvar not winning over an option 'default'. Previously
  188. an option with both `default` and `env` would never take a value from the
  189. environment variable. E.g. `FOO_FILE` would never work here:
  190. options: [ {
  191. names: ['file', 'f'],
  192. env: 'FOO_FILE',
  193. 'default': 'default.file',
  194. type: 'string'
  195. } ],
  196. ## 1.3.0
  197. - [Backward incompatible change for boolean envvars] Change the
  198. interpretation of environment variables for boolean options to consider '0'
  199. to be false. Previous to this *any* value to the envvar was considered
  200. true -- which was quite misleading. Example:
  201. $ FOO_VERBOSE=0 node examples/foo.js
  202. # opts: { verbose: [ false ],
  203. _order: [ { key: 'verbose', value: false, from: 'env' } ],
  204. _args: [] }
  205. # args: []
  206. ## 1.2.1
  207. - Fix for `parse.help({includeEnv: true, ...})` handling to ensure that an
  208. option with an `env` **but no `help`** still has the "Environment: ..."
  209. output. E.g.:
  210. { names: ['foo'], type: 'string', env: 'FOO' }
  211. ...
  212. --foo=ARG Environment: FOO=ARG
  213. ## 1.2.0
  214. - Transform the option key on the `opts` object returned from
  215. `<parser>.parse()` for convenience. Currently this is just
  216. `s/-/_/g`, e.g. '--dry-run' -> `opts.dry_run`. This allow one to use hyphen
  217. in option names (common) but not have to do silly things like
  218. `opt["dry-run"]` to access the parsed results.
  219. ## 1.1.0
  220. - Environment variable integration. Envvars can be associated with an option,
  221. then option processing will fallback to using that envvar if defined and
  222. if the option isn't specified in argv. See the "Environment variable
  223. integration" section in the README.
  224. - Change the `<parser>.parse()` signature to take a single object with keys
  225. for arguments. The old signature is still supported.
  226. - `dashdash.createParser(CONFIG)` alternative to `new dashdash.Parser(CONFIG)`
  227. a la many node-land APIs.
  228. ## 1.0.2
  229. - Add "positiveInteger" and "arrayOfPositiveInteger" option types that only
  230. accept positive integers.
  231. - Add "integer" and "arrayOfInteger" option types that accepts only integers.
  232. Note that, for better or worse, these do NOT accept: "0x42" (hex), "1e2"
  233. (with exponent) or "1.", "3.0" (floats).
  234. ## 1.0.1
  235. - Fix not modifying the given option spec objects (which breaks creating
  236. a Parser with them more than once).
  237. ## 1.0.0
  238. First release.