@hugojosefson/cli 0.11.0 β†’ 0.13.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.
Files changed (214) hide show
  1. package/README.md +1 -1
  2. package/esm/deno.js +16 -8
  3. package/esm/hj.js +19 -0
  4. package/esm/node_modules/@conventional-changelog/template/LICENSE.md +21 -0
  5. package/esm/node_modules/@conventional-changelog/template/README.md +66 -0
  6. package/esm/node_modules/@conventional-changelog/template/dist/elements.d.ts +78 -0
  7. package/esm/node_modules/@conventional-changelog/template/dist/elements.d.ts.map +1 -0
  8. package/esm/node_modules/@conventional-changelog/template/dist/elements.js +132 -0
  9. package/esm/node_modules/@conventional-changelog/template/dist/index.d.ts +6 -0
  10. package/esm/node_modules/@conventional-changelog/template/dist/index.d.ts.map +1 -0
  11. package/esm/node_modules/@conventional-changelog/template/dist/index.js +5 -0
  12. package/esm/node_modules/@conventional-changelog/template/dist/legacy.d.ts +20 -0
  13. package/esm/node_modules/@conventional-changelog/template/dist/legacy.d.ts.map +1 -0
  14. package/esm/node_modules/@conventional-changelog/template/dist/legacy.js +22 -0
  15. package/esm/node_modules/@conventional-changelog/template/dist/references.d.ts +43 -0
  16. package/esm/node_modules/@conventional-changelog/template/dist/references.d.ts.map +1 -0
  17. package/esm/node_modules/@conventional-changelog/template/dist/references.js +82 -0
  18. package/esm/node_modules/@conventional-changelog/template/dist/templates.d.ts +74 -0
  19. package/esm/node_modules/@conventional-changelog/template/dist/templates.d.ts.map +1 -0
  20. package/esm/node_modules/@conventional-changelog/template/dist/templates.js +125 -0
  21. package/esm/node_modules/@conventional-changelog/template/dist/types/commit.d.ts +37 -0
  22. package/esm/node_modules/@conventional-changelog/template/dist/types/commit.d.ts.map +1 -0
  23. package/esm/node_modules/@conventional-changelog/template/dist/types/commit.js +2 -0
  24. package/esm/node_modules/@conventional-changelog/template/dist/types/context.d.ts +113 -0
  25. package/esm/node_modules/@conventional-changelog/template/dist/types/context.d.ts.map +1 -0
  26. package/esm/node_modules/@conventional-changelog/template/dist/types/context.js +2 -0
  27. package/esm/node_modules/@conventional-changelog/template/dist/types/index.d.ts +4 -0
  28. package/esm/node_modules/@conventional-changelog/template/dist/types/index.d.ts.map +1 -0
  29. package/esm/node_modules/@conventional-changelog/template/dist/types/index.js +2 -0
  30. package/esm/node_modules/@conventional-changelog/template/dist/types/utils.d.ts +2 -0
  31. package/esm/node_modules/@conventional-changelog/template/dist/types/utils.d.ts.map +1 -0
  32. package/esm/node_modules/@conventional-changelog/template/dist/types/utils.js +2 -0
  33. package/esm/node_modules/@conventional-changelog/template/package.json +38 -0
  34. package/esm/node_modules/@simple-libs/stream-utils/LICENSE +21 -0
  35. package/esm/node_modules/@simple-libs/stream-utils/README.md +79 -0
  36. package/esm/node_modules/@simple-libs/stream-utils/dist/index.d.ts +51 -0
  37. package/esm/node_modules/@simple-libs/stream-utils/dist/index.d.ts.map +1 -0
  38. package/esm/node_modules/@simple-libs/stream-utils/dist/index.js +116 -0
  39. package/esm/node_modules/@simple-libs/stream-utils/package.json +38 -0
  40. package/esm/node_modules/argue-cli/LICENSE +21 -0
  41. package/esm/node_modules/argue-cli/README.md +239 -0
  42. package/esm/node_modules/argue-cli/dist/args.d.ts +30 -0
  43. package/esm/node_modules/argue-cli/dist/args.d.ts.map +1 -0
  44. package/esm/node_modules/argue-cli/dist/argv.d.ts +14 -0
  45. package/esm/node_modules/argue-cli/dist/argv.d.ts.map +1 -0
  46. package/esm/node_modules/argue-cli/dist/core.d.ts +24 -0
  47. package/esm/node_modules/argue-cli/dist/core.d.ts.map +1 -0
  48. package/esm/node_modules/argue-cli/dist/index.d.ts +6 -0
  49. package/esm/node_modules/argue-cli/dist/index.d.ts.map +1 -0
  50. package/esm/node_modules/argue-cli/dist/index.js +254 -0
  51. package/esm/node_modules/argue-cli/dist/index.js.map +1 -0
  52. package/esm/node_modules/argue-cli/dist/options.d.ts +9 -0
  53. package/esm/node_modules/argue-cli/dist/options.d.ts.map +1 -0
  54. package/esm/node_modules/argue-cli/dist/types.d.ts +16 -0
  55. package/esm/node_modules/argue-cli/dist/types.d.ts.map +1 -0
  56. package/esm/node_modules/argue-cli/dist/utils.d.ts +24 -0
  57. package/esm/node_modules/argue-cli/dist/utils.d.ts.map +1 -0
  58. package/esm/node_modules/argue-cli/package.json +34 -0
  59. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/LICENSE.md +21 -0
  60. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/README.md +369 -0
  61. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/package.json +53 -0
  62. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/LICENSE +21 -0
  63. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/README.md +184 -0
  64. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/package.json +31 -0
  65. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/LICENSE.md +21 -0
  66. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/README.md +383 -0
  67. package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/package.json +47 -0
  68. package/esm/node_modules/conventional-changelog-writer/README.md +49 -342
  69. package/esm/node_modules/conventional-changelog-writer/dist/cli/index.d.ts +3 -0
  70. package/esm/node_modules/conventional-changelog-writer/dist/cli/index.d.ts.map +1 -0
  71. package/esm/node_modules/conventional-changelog-writer/dist/cli/index.js +68 -0
  72. package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.d.ts +4 -0
  73. package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.d.ts.map +1 -0
  74. package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.js +39 -0
  75. package/esm/node_modules/conventional-changelog-writer/dist/commit.d.ts +10 -0
  76. package/esm/node_modules/conventional-changelog-writer/dist/commit.d.ts.map +1 -0
  77. package/esm/node_modules/conventional-changelog-writer/dist/commit.js +43 -0
  78. package/esm/node_modules/conventional-changelog-writer/dist/context.d.ts +27 -0
  79. package/esm/node_modules/conventional-changelog-writer/dist/context.d.ts.map +1 -0
  80. package/esm/node_modules/conventional-changelog-writer/dist/context.js +134 -0
  81. package/esm/node_modules/conventional-changelog-writer/dist/index.d.ts +7 -0
  82. package/esm/node_modules/conventional-changelog-writer/dist/index.d.ts.map +1 -0
  83. package/esm/node_modules/conventional-changelog-writer/dist/index.js +6 -0
  84. package/esm/node_modules/conventional-changelog-writer/dist/options.d.ts +25 -0
  85. package/esm/node_modules/conventional-changelog-writer/dist/options.d.ts.map +1 -0
  86. package/esm/node_modules/conventional-changelog-writer/dist/options.js +79 -0
  87. package/esm/node_modules/conventional-changelog-writer/dist/template.d.ts +10 -0
  88. package/esm/node_modules/conventional-changelog-writer/dist/template.d.ts.map +1 -0
  89. package/esm/node_modules/conventional-changelog-writer/dist/template.js +18 -0
  90. package/esm/node_modules/conventional-changelog-writer/dist/types/index.d.ts +8 -0
  91. package/esm/node_modules/conventional-changelog-writer/dist/types/index.d.ts.map +1 -0
  92. package/esm/node_modules/conventional-changelog-writer/dist/types/index.js +2 -0
  93. package/esm/node_modules/conventional-changelog-writer/dist/types/options.d.ts +122 -0
  94. package/esm/node_modules/conventional-changelog-writer/dist/types/options.d.ts.map +1 -0
  95. package/esm/node_modules/conventional-changelog-writer/dist/types/options.js +2 -0
  96. package/esm/node_modules/conventional-changelog-writer/dist/types/utils.d.ts +9 -0
  97. package/esm/node_modules/conventional-changelog-writer/dist/types/utils.d.ts.map +1 -0
  98. package/esm/node_modules/conventional-changelog-writer/dist/types/utils.js +2 -0
  99. package/esm/node_modules/conventional-changelog-writer/dist/utils.d.ts +20 -0
  100. package/esm/node_modules/conventional-changelog-writer/dist/utils.d.ts.map +1 -0
  101. package/esm/node_modules/conventional-changelog-writer/dist/utils.js +70 -0
  102. package/esm/node_modules/conventional-changelog-writer/dist/writers.d.ts +29 -0
  103. package/esm/node_modules/conventional-changelog-writer/dist/writers.d.ts.map +1 -0
  104. package/esm/node_modules/conventional-changelog-writer/dist/writers.js +94 -0
  105. package/esm/node_modules/conventional-changelog-writer/package.json +24 -26
  106. package/esm/node_modules/conventional-commits-filter/README.md +51 -170
  107. package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.d.ts +17 -0
  108. package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.d.ts.map +1 -0
  109. package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.js +46 -0
  110. package/esm/node_modules/conventional-commits-filter/dist/filters.d.ts +19 -0
  111. package/esm/node_modules/conventional-commits-filter/dist/filters.d.ts.map +1 -0
  112. package/esm/node_modules/conventional-commits-filter/dist/filters.js +34 -0
  113. package/esm/node_modules/conventional-commits-filter/dist/index.d.ts +4 -0
  114. package/esm/node_modules/conventional-commits-filter/dist/index.d.ts.map +1 -0
  115. package/esm/node_modules/conventional-commits-filter/dist/index.js +3 -0
  116. package/esm/node_modules/conventional-commits-filter/dist/types.d.ts +6 -0
  117. package/esm/node_modules/conventional-commits-filter/dist/types.d.ts.map +1 -0
  118. package/esm/node_modules/conventional-commits-filter/dist/types.js +2 -0
  119. package/esm/node_modules/conventional-commits-filter/dist/utils.d.ts +16 -0
  120. package/esm/node_modules/conventional-commits-filter/dist/utils.d.ts.map +1 -0
  121. package/esm/node_modules/conventional-commits-filter/dist/utils.js +43 -0
  122. package/esm/node_modules/conventional-commits-filter/package.json +22 -16
  123. package/esm/node_modules/conventional-commits-parser/README.md +49 -353
  124. package/esm/node_modules/conventional-commits-parser/dist/CommitParser.d.ts +40 -0
  125. package/esm/node_modules/conventional-commits-parser/dist/CommitParser.d.ts.map +1 -0
  126. package/esm/node_modules/conventional-commits-parser/dist/CommitParser.js +319 -0
  127. package/esm/node_modules/conventional-commits-parser/dist/cli/index.d.ts +3 -0
  128. package/esm/node_modules/conventional-commits-parser/dist/cli/index.d.ts.map +1 -0
  129. package/esm/node_modules/conventional-commits-parser/dist/cli/index.js +67 -0
  130. package/esm/node_modules/conventional-commits-parser/dist/cli/options.d.ts +3 -0
  131. package/esm/node_modules/conventional-commits-parser/dist/cli/options.d.ts.map +1 -0
  132. package/esm/node_modules/conventional-commits-parser/dist/cli/options.js +40 -0
  133. package/esm/node_modules/conventional-commits-parser/dist/cli/utils.d.ts +5 -0
  134. package/esm/node_modules/conventional-commits-parser/dist/cli/utils.d.ts.map +1 -0
  135. package/esm/node_modules/conventional-commits-parser/dist/cli/utils.js +49 -0
  136. package/esm/node_modules/conventional-commits-parser/dist/index.d.ts +4 -0
  137. package/esm/node_modules/conventional-commits-parser/dist/index.d.ts.map +1 -0
  138. package/esm/node_modules/conventional-commits-parser/dist/index.js +3 -0
  139. package/esm/node_modules/conventional-commits-parser/dist/options.d.ts +3 -0
  140. package/esm/node_modules/conventional-commits-parser/dist/options.d.ts.map +1 -0
  141. package/esm/node_modules/conventional-commits-parser/dist/options.js +27 -0
  142. package/esm/node_modules/conventional-commits-parser/dist/regex.d.ts +8 -0
  143. package/esm/node_modules/conventional-commits-parser/dist/regex.d.ts.map +1 -0
  144. package/esm/node_modules/conventional-commits-parser/dist/regex.js +63 -0
  145. package/esm/node_modules/conventional-commits-parser/dist/stream.d.ts +14 -0
  146. package/esm/node_modules/conventional-commits-parser/dist/stream.d.ts.map +1 -0
  147. package/esm/node_modules/conventional-commits-parser/dist/stream.js +38 -0
  148. package/esm/node_modules/conventional-commits-parser/dist/types.d.ts +100 -0
  149. package/esm/node_modules/conventional-commits-parser/dist/types.d.ts.map +1 -0
  150. package/esm/node_modules/conventional-commits-parser/dist/types.js +2 -0
  151. package/esm/node_modules/conventional-commits-parser/dist/utils.d.ts +41 -0
  152. package/esm/node_modules/conventional-commits-parser/dist/utils.d.ts.map +1 -0
  153. package/esm/node_modules/conventional-commits-parser/dist/utils.js +75 -0
  154. package/esm/node_modules/conventional-commits-parser/package.json +22 -23
  155. package/esm/src/cli/command-help.js +15 -0
  156. package/esm/src/cli/repair-configuration-description.js +98 -0
  157. package/esm/src/cli/run-changelog.js +51 -0
  158. package/esm/src/cli/run-cli.js +8 -0
  159. package/esm/src/features/built-in-feature-registry.js +2 -0
  160. package/esm/src/features/changelog-feature.js +155 -0
  161. package/esm/src/features/github-ci-artifacts.js +17 -3
  162. package/esm/src/features/github-ci-runtime-matrix.js +50 -0
  163. package/esm/src/features/github-release-publish-artifacts.js +5 -4
  164. package/esm/src/features/github-release-publish-feature.js +7 -2
  165. package/esm/src/features/github-workflow-cache.js +18 -0
  166. package/esm/src/features/npm-readme-badge.js +163 -0
  167. package/esm/src/features/readme-contribution-plans.js +18 -1
  168. package/esm/src/features/workflow-deno.js +1 -1
  169. package/esm/src/package/npm-name.js +5 -0
  170. package/esm/src/readme/contribution-blocks.js +33 -6
  171. package/esm/src/release/changelog-markdown.js +41 -0
  172. package/esm/src/release/changelog.js +155 -7
  173. package/esm/src/release/format-changelog.js +15 -0
  174. package/esm/src/release/migrate-changelog.js +92 -0
  175. package/esm/src/release/publish-github.js +7 -3
  176. package/esm/src/release/publish-npm.js +2 -2
  177. package/esm/src/release/publish-tag-prepare.js +63 -78
  178. package/esm/src/release/release-history.js +53 -0
  179. package/npm-dependencies.lock.json +115 -48
  180. package/package.json +7 -5
  181. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/dependencies.js +0 -11036
  182. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/index.d.ts +0 -1416
  183. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/index.js +0 -100
  184. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/licenses.md +0 -1767
  185. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/options.js +0 -92
  186. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/parser.js +0 -84
  187. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/utils.js +0 -7
  188. package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/validate.js +0 -122
  189. package/esm/node_modules/conventional-commits-parser/node_modules/meow/license +0 -9
  190. package/esm/node_modules/conventional-commits-parser/node_modules/meow/package.json +0 -107
  191. package/esm/node_modules/conventional-commits-parser/node_modules/meow/readme.md +0 -314
  192. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core/node_modules/conventional-changelog-writer}/cli.mjs +0 -0
  193. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core/node_modules/conventional-changelog-writer}/index.js +0 -0
  194. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core/node_modules/conventional-changelog-writer}/lib/util.js +0 -0
  195. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/commit.hbs +0 -0
  196. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/footer.hbs +0 -0
  197. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/header.hbs +0 -0
  198. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/template.hbs +0 -0
  199. /package/esm/node_modules/{conventional-commits-filter β†’ conventional-changelog-core/node_modules/conventional-commits-filter}/index.js +0 -0
  200. /package/esm/node_modules/{conventional-commits-parser β†’ conventional-changelog-core/node_modules/conventional-commits-parser}/cli.mjs +0 -0
  201. /package/esm/node_modules/{conventional-commits-parser β†’ conventional-changelog-core/node_modules/conventional-commits-parser}/index.js +0 -0
  202. /package/esm/node_modules/{conventional-commits-parser β†’ conventional-changelog-core/node_modules/conventional-commits-parser}/lib/parser.js +0 -0
  203. /package/esm/node_modules/{conventional-commits-parser β†’ conventional-changelog-core/node_modules/conventional-commits-parser}/lib/regex.js +0 -0
  204. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core}/node_modules/meow/build/dependencies.js +0 -0
  205. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core}/node_modules/meow/build/index.d.ts +0 -0
  206. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core}/node_modules/meow/build/index.js +0 -0
  207. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core}/node_modules/meow/build/licenses.md +0 -0
  208. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core}/node_modules/meow/build/options.js +0 -0
  209. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core}/node_modules/meow/build/parser.js +0 -0
  210. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core}/node_modules/meow/build/utils.js +0 -0
  211. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core}/node_modules/meow/build/validate.js +0 -0
  212. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core}/node_modules/meow/license +0 -0
  213. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core}/node_modules/meow/package.json +0 -0
  214. /package/esm/node_modules/{conventional-changelog-writer β†’ conventional-changelog-core}/node_modules/meow/readme.md +0 -0
@@ -1,314 +0,0 @@
1
- # meow
2
-
3
- > CLI app helper
4
-
5
- ![](meow.gif)
6
-
7
- *I would recommend reading this [guide](https://clig.dev) on how to make user-friendly command-line tools.*
8
-
9
- ## Features
10
-
11
- - Parses arguments
12
- - Converts flags to [camelCase](https://github.com/sindresorhus/camelcase)
13
- - Negates flags when using the `--no-` prefix
14
- - Outputs version when `--version`
15
- - Outputs description and supplied help text when `--help`
16
- - Makes unhandled rejected promises [fail hard](https://github.com/sindresorhus/hard-rejection) instead of the default silent fail
17
- - Sets the process title to the binary name defined in package.json
18
- - No dependencies!
19
-
20
- ## Install
21
-
22
- ```sh
23
- npm install meow
24
- ```
25
-
26
- ## Usage
27
-
28
- ```sh
29
- ./foo-app.js unicorns --rainbow
30
- ```
31
-
32
- ```js
33
- #!/usr/bin/env node
34
- import meow from 'meow';
35
- import foo from './lib/index.js';
36
-
37
- const cli = meow(`
38
- Usage
39
- $ foo <input>
40
-
41
- Options
42
- --rainbow, -r Include a rainbow
43
-
44
- Examples
45
- $ foo unicorns --rainbow
46
- 🌈 unicorns 🌈
47
- `, {
48
- importMeta: import.meta,
49
- flags: {
50
- rainbow: {
51
- type: 'boolean',
52
- shortFlag: 'r'
53
- }
54
- }
55
- });
56
- /*
57
- {
58
- input: ['unicorns'],
59
- flags: {rainbow: true},
60
- ...
61
- }
62
- */
63
-
64
- foo(cli.input.at(0), cli.flags);
65
- ```
66
-
67
- ## API
68
-
69
- ### meow(helpText, options?)
70
- ### meow(options)
71
-
72
- Returns an `object` with:
73
-
74
- - `input` *(Array)* - Non-flag arguments
75
- - `flags` *(Object)* - Flags converted to camelCase excluding aliases
76
- - `unnormalizedFlags` *(Object)* - Flags converted to camelCase including aliases
77
- - `pkg` *(Object)* - The `package.json` object
78
- - `help` *(string)* - The help text used with `--help`
79
- - `showHelp([exitCode=2])` *(Function)* - Show the help text and exit with `exitCode`
80
- - `showVersion()` *(Function)* - Show the version text and exit
81
-
82
- #### helpText
83
-
84
- Type: `string`
85
-
86
- Shortcut for the `help` option.
87
-
88
- #### options
89
-
90
- Type: `object`
91
-
92
- ##### importMeta
93
-
94
- Type: `object`
95
-
96
- Pass in [`import.meta`](https://nodejs.org/dist/latest/docs/api/esm.html#esm_import_meta). This is used to find the correct package.json file.
97
-
98
- ##### flags
99
-
100
- Type: `object`
101
-
102
- Define argument flags.
103
-
104
- The key is the flag name in camel-case and the value is an object with any of:
105
-
106
- - `type`: Type of value. (Possible values: `string` `boolean` `number`)
107
- - `choices`: Limit valid values to a predefined set of choices.
108
- - `default`: Default value when the flag is not specified.
109
- - `shortFlag`: A short flag alias.
110
- - `aliases`: Other names for the flag.
111
- - `isMultiple`: Indicates a flag can be set multiple times. Values are turned into an array. (Default: false)
112
- - Multiple values are provided by specifying the flag multiple times, for example, `$ foo -u rainbow -u cat`. Space- or comma-separated values are [currently *not* supported](https://github.com/sindresorhus/meow/issues/164).
113
- - `isRequired`: Determine if the flag is required. (Default: false)
114
- - If it's only known at runtime whether the flag is required or not, you can pass a `Function` instead of a `boolean`, which based on the given flags and other non-flag arguments, should decide if the flag is required. Two arguments are passed to the function:
115
- - The first argument is the **flags** object, which contains the flags converted to camel-case excluding aliases.
116
- - The second argument is the **input** string array, which contains the non-flag arguments.
117
- - The function should return a `boolean`, true if the flag is required, otherwise false.
118
-
119
- Note that flags are always defined using a camel-case key (`myKey`), but will match arguments in kebab-case (`--my-key`).
120
-
121
- Example:
122
-
123
- ```js
124
- flags: {
125
- unicorn: {
126
- type: 'string',
127
- choices: ['rainbow', 'cat', 'unicorn'],
128
- default: ['rainbow', 'cat'],
129
- shortFlag: 'u',
130
- aliases: ['unicorns'],
131
- isMultiple: true,
132
- isRequired: (flags, input) => {
133
- if (flags.otherFlag) {
134
- return true;
135
- }
136
-
137
- return false;
138
- }
139
- }
140
- }
141
- ```
142
-
143
- ##### description
144
-
145
- Type: `string | boolean`\
146
- Default: The package.json `"description"` property
147
-
148
- Description to show above the help text.
149
-
150
- Set it to `false` to disable it altogether.
151
-
152
- ##### help
153
-
154
- Type: `string | boolean`
155
-
156
- The help text you want shown.
157
-
158
- The input is reindented and starting/ending newlines are trimmed which means you can use a [template literal](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/template_strings) without having to care about using the correct amount of indent.
159
-
160
- The description will be shown above your help text automatically.
161
-
162
- ##### version
163
-
164
- Type: `string | boolean`\
165
- Default: The package.json `"version"` property
166
-
167
- Set a custom version output.
168
-
169
- ##### autoHelp
170
-
171
- Type: `boolean`\
172
- Default: `true`
173
-
174
- Automatically show the help text when the `--help` flag is present. Useful to set this value to `false` when a CLI manages child CLIs with their own help text.
175
-
176
- This option is only considered when there is only one argument in `process.argv`.
177
-
178
- ##### autoVersion
179
-
180
- Type: `boolean`\
181
- Default: `true`
182
-
183
- Automatically show the version text when the `--version` flag is present. Useful to set this value to `false` when a CLI manages child CLIs with their own version text.
184
-
185
- This option is only considered when there is only one argument in `process.argv`.
186
-
187
- ##### pkg
188
-
189
- Type: `object`\
190
- Default: Closest package.json upwards
191
-
192
- package.json as an `object`.
193
-
194
- Note: Setting this stops `meow` from finding a package.json.
195
-
196
- *You most likely don't need this option.*
197
-
198
- ##### argv
199
-
200
- Type: `string[]`\
201
- Default: `process.argv.slice(2)`
202
-
203
- Custom arguments object.
204
-
205
- ##### inferType
206
-
207
- Type: `boolean`\
208
- Default: `false`
209
-
210
- Infer the argument type.
211
-
212
- By default, the argument `5` in `$ foo 5` becomes a string. Enabling this would infer it as a number.
213
-
214
- ##### booleanDefault
215
-
216
- Type: `boolean | null | undefined`\
217
- Default: `false`
218
-
219
- Value of `boolean` flags not defined in `argv`.
220
-
221
- If set to `undefined`, the flags not defined in `argv` will be excluded from the result.
222
- The `default` value set in `boolean` flags take precedence over `booleanDefault`.
223
-
224
- _Note: If used in conjunction with `isMultiple`, the default flag value is set to `[]`._
225
-
226
- __Caution: Explicitly specifying `undefined` for `booleanDefault` has different meaning from omitting key itself.__
227
-
228
- Example:
229
-
230
- ```js
231
- import meow from 'meow';
232
-
233
- const cli = meow(`
234
- Usage
235
- $ foo
236
-
237
- Options
238
- --rainbow, -r Include a rainbow
239
- --unicorn, -u Include a unicorn
240
- --no-sparkles Exclude sparkles
241
-
242
- Examples
243
- $ foo
244
- 🌈 unicorns✨🌈
245
- `, {
246
- importMeta: import.meta,
247
- booleanDefault: undefined,
248
- flags: {
249
- rainbow: {
250
- type: 'boolean',
251
- default: true,
252
- shortFlag: 'r'
253
- },
254
- unicorn: {
255
- type: 'boolean',
256
- default: false,
257
- shortFlag: 'u'
258
- },
259
- cake: {
260
- type: 'boolean',
261
- shortFlag: 'c'
262
- },
263
- sparkles: {
264
- type: 'boolean',
265
- default: true
266
- }
267
- }
268
- });
269
- /*
270
- {
271
- flags: {
272
- rainbow: true,
273
- unicorn: false,
274
- sparkles: true
275
- },
276
- unnormalizedFlags: {
277
- rainbow: true,
278
- r: true,
279
- unicorn: false,
280
- u: false,
281
- sparkles: true
282
- },
283
- …
284
- }
285
- */
286
- ```
287
-
288
- ##### hardRejection
289
-
290
- Type: `boolean`\
291
- Default: `true`
292
-
293
- Whether to use [`hard-rejection`](https://github.com/sindresorhus/hard-rejection) or not. Disabling this can be useful if you need to handle `process.on('unhandledRejection')` yourself.
294
-
295
- ##### allowUnknownFlags
296
-
297
- Type `boolean`\
298
- Default: `true`
299
-
300
- Whether to allow unknown flags or not.
301
-
302
- ## Promises
303
-
304
- Meow will make unhandled rejected promises [fail hard](https://github.com/sindresorhus/hard-rejection) instead of the default silent fail. Meaning you don't have to manually `.catch()` promises used in your CLI.
305
-
306
- ## Tips
307
-
308
- See [`chalk`](https://github.com/chalk/chalk) if you want to colorize the terminal output.
309
-
310
- See [`get-stdin`](https://github.com/sindresorhus/get-stdin) if you want to accept input from stdin.
311
-
312
- See [`conf`](https://github.com/sindresorhus/conf) if you need to persist some data.
313
-
314
- [More useful CLI utilities…](https://github.com/sindresorhus/awesome-nodejs#command-line-utilities)