korext 0.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.
Files changed (517) hide show
  1. package/bin/korext.js +278 -0
  2. package/korext-cli-0.1.0.tgz +0 -0
  3. package/node_modules/ansi-regex/index.d.ts +37 -0
  4. package/node_modules/ansi-regex/index.js +10 -0
  5. package/node_modules/ansi-regex/license +9 -0
  6. package/node_modules/ansi-regex/package.json +55 -0
  7. package/node_modules/ansi-regex/readme.md +78 -0
  8. package/node_modules/ansi-styles/index.d.ts +345 -0
  9. package/node_modules/ansi-styles/index.js +163 -0
  10. package/node_modules/ansi-styles/license +9 -0
  11. package/node_modules/ansi-styles/package.json +56 -0
  12. package/node_modules/ansi-styles/readme.md +152 -0
  13. package/node_modules/balanced-match/LICENSE.md +23 -0
  14. package/node_modules/balanced-match/README.md +57 -0
  15. package/node_modules/balanced-match/dist/commonjs/index.d.ts +9 -0
  16. package/node_modules/balanced-match/dist/commonjs/index.d.ts.map +1 -0
  17. package/node_modules/balanced-match/dist/commonjs/index.js +59 -0
  18. package/node_modules/balanced-match/dist/commonjs/index.js.map +1 -0
  19. package/node_modules/balanced-match/dist/commonjs/package.json +3 -0
  20. package/node_modules/balanced-match/dist/esm/index.d.ts +9 -0
  21. package/node_modules/balanced-match/dist/esm/index.d.ts.map +1 -0
  22. package/node_modules/balanced-match/dist/esm/index.js +54 -0
  23. package/node_modules/balanced-match/dist/esm/index.js.map +1 -0
  24. package/node_modules/balanced-match/dist/esm/package.json +3 -0
  25. package/node_modules/balanced-match/package.json +68 -0
  26. package/node_modules/base64-js/LICENSE +21 -0
  27. package/node_modules/base64-js/README.md +34 -0
  28. package/node_modules/base64-js/base64js.min.js +1 -0
  29. package/node_modules/base64-js/index.d.ts +3 -0
  30. package/node_modules/base64-js/index.js +150 -0
  31. package/node_modules/base64-js/package.json +47 -0
  32. package/node_modules/bl/.travis.yml +17 -0
  33. package/node_modules/bl/BufferList.js +396 -0
  34. package/node_modules/bl/LICENSE.md +13 -0
  35. package/node_modules/bl/README.md +247 -0
  36. package/node_modules/bl/bl.js +84 -0
  37. package/node_modules/bl/package.json +37 -0
  38. package/node_modules/bl/test/convert.js +21 -0
  39. package/node_modules/bl/test/indexOf.js +492 -0
  40. package/node_modules/bl/test/isBufferList.js +32 -0
  41. package/node_modules/bl/test/test.js +869 -0
  42. package/node_modules/brace-expansion/LICENSE +23 -0
  43. package/node_modules/brace-expansion/README.md +94 -0
  44. package/node_modules/brace-expansion/dist/commonjs/index.d.ts +6 -0
  45. package/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -0
  46. package/node_modules/brace-expansion/dist/commonjs/index.js +199 -0
  47. package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -0
  48. package/node_modules/brace-expansion/dist/commonjs/package.json +3 -0
  49. package/node_modules/brace-expansion/dist/esm/index.d.ts +6 -0
  50. package/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -0
  51. package/node_modules/brace-expansion/dist/esm/index.js +195 -0
  52. package/node_modules/brace-expansion/dist/esm/index.js.map +1 -0
  53. package/node_modules/brace-expansion/dist/esm/package.json +3 -0
  54. package/node_modules/brace-expansion/package.json +64 -0
  55. package/node_modules/buffer/AUTHORS.md +70 -0
  56. package/node_modules/buffer/LICENSE +21 -0
  57. package/node_modules/buffer/README.md +410 -0
  58. package/node_modules/buffer/index.d.ts +186 -0
  59. package/node_modules/buffer/index.js +1817 -0
  60. package/node_modules/buffer/package.json +96 -0
  61. package/node_modules/chalk/index.d.ts +415 -0
  62. package/node_modules/chalk/license +9 -0
  63. package/node_modules/chalk/package.json +68 -0
  64. package/node_modules/chalk/readme.md +341 -0
  65. package/node_modules/chalk/source/index.js +229 -0
  66. package/node_modules/chalk/source/templates.js +134 -0
  67. package/node_modules/chalk/source/util.js +39 -0
  68. package/node_modules/cli-cursor/index.d.ts +45 -0
  69. package/node_modules/cli-cursor/index.js +35 -0
  70. package/node_modules/cli-cursor/license +9 -0
  71. package/node_modules/cli-cursor/package.json +46 -0
  72. package/node_modules/cli-cursor/readme.md +55 -0
  73. package/node_modules/cli-spinners/index.d.ts +128 -0
  74. package/node_modules/cli-spinners/index.js +15 -0
  75. package/node_modules/cli-spinners/license +9 -0
  76. package/node_modules/cli-spinners/package.json +50 -0
  77. package/node_modules/cli-spinners/readme.md +54 -0
  78. package/node_modules/cli-spinners/spinners.json +1622 -0
  79. package/node_modules/clone/.npmignore +4 -0
  80. package/node_modules/clone/LICENSE +18 -0
  81. package/node_modules/clone/README.md +126 -0
  82. package/node_modules/clone/clone.iml +10 -0
  83. package/node_modules/clone/clone.js +166 -0
  84. package/node_modules/clone/package.json +51 -0
  85. package/node_modules/color-convert/CHANGELOG.md +54 -0
  86. package/node_modules/color-convert/LICENSE +21 -0
  87. package/node_modules/color-convert/README.md +68 -0
  88. package/node_modules/color-convert/conversions.js +839 -0
  89. package/node_modules/color-convert/index.js +81 -0
  90. package/node_modules/color-convert/package.json +48 -0
  91. package/node_modules/color-convert/route.js +97 -0
  92. package/node_modules/color-name/LICENSE +8 -0
  93. package/node_modules/color-name/README.md +11 -0
  94. package/node_modules/color-name/index.js +152 -0
  95. package/node_modules/color-name/package.json +28 -0
  96. package/node_modules/commander/LICENSE +22 -0
  97. package/node_modules/commander/Readme.md +1176 -0
  98. package/node_modules/commander/esm.mjs +16 -0
  99. package/node_modules/commander/index.js +24 -0
  100. package/node_modules/commander/lib/argument.js +150 -0
  101. package/node_modules/commander/lib/command.js +2777 -0
  102. package/node_modules/commander/lib/error.js +39 -0
  103. package/node_modules/commander/lib/help.js +747 -0
  104. package/node_modules/commander/lib/option.js +380 -0
  105. package/node_modules/commander/lib/suggestSimilar.js +101 -0
  106. package/node_modules/commander/package-support.json +19 -0
  107. package/node_modules/commander/package.json +82 -0
  108. package/node_modules/commander/typings/esm.d.mts +3 -0
  109. package/node_modules/commander/typings/index.d.ts +1113 -0
  110. package/node_modules/data-uri-to-buffer/README.md +88 -0
  111. package/node_modules/data-uri-to-buffer/dist/index.d.ts +15 -0
  112. package/node_modules/data-uri-to-buffer/dist/index.js +53 -0
  113. package/node_modules/data-uri-to-buffer/dist/index.js.map +1 -0
  114. package/node_modules/data-uri-to-buffer/package.json +62 -0
  115. package/node_modules/data-uri-to-buffer/src/index.ts +68 -0
  116. package/node_modules/defaults/LICENSE +22 -0
  117. package/node_modules/defaults/README.md +39 -0
  118. package/node_modules/defaults/index.js +13 -0
  119. package/node_modules/defaults/package.json +33 -0
  120. package/node_modules/defaults/test.js +34 -0
  121. package/node_modules/fetch-blob/LICENSE +21 -0
  122. package/node_modules/fetch-blob/README.md +106 -0
  123. package/node_modules/fetch-blob/file.d.ts +2 -0
  124. package/node_modules/fetch-blob/file.js +49 -0
  125. package/node_modules/fetch-blob/from.d.ts +26 -0
  126. package/node_modules/fetch-blob/from.js +100 -0
  127. package/node_modules/fetch-blob/index.d.ts +3 -0
  128. package/node_modules/fetch-blob/index.js +250 -0
  129. package/node_modules/fetch-blob/package.json +56 -0
  130. package/node_modules/fetch-blob/streams.cjs +51 -0
  131. package/node_modules/formdata-polyfill/FormData.js +441 -0
  132. package/node_modules/formdata-polyfill/LICENSE +21 -0
  133. package/node_modules/formdata-polyfill/README.md +145 -0
  134. package/node_modules/formdata-polyfill/esm.min.d.ts +5 -0
  135. package/node_modules/formdata-polyfill/esm.min.js +40 -0
  136. package/node_modules/formdata-polyfill/formdata-to-blob.js +39 -0
  137. package/node_modules/formdata-polyfill/formdata.min.js +21 -0
  138. package/node_modules/formdata-polyfill/package.json +50 -0
  139. package/node_modules/glob/LICENSE.md +63 -0
  140. package/node_modules/glob/README.md +1203 -0
  141. package/node_modules/glob/dist/commonjs/glob.d.ts +396 -0
  142. package/node_modules/glob/dist/commonjs/glob.d.ts.map +1 -0
  143. package/node_modules/glob/dist/commonjs/glob.js +248 -0
  144. package/node_modules/glob/dist/commonjs/glob.js.map +1 -0
  145. package/node_modules/glob/dist/commonjs/has-magic.d.ts +14 -0
  146. package/node_modules/glob/dist/commonjs/has-magic.d.ts.map +1 -0
  147. package/node_modules/glob/dist/commonjs/has-magic.js +27 -0
  148. package/node_modules/glob/dist/commonjs/has-magic.js.map +1 -0
  149. package/node_modules/glob/dist/commonjs/ignore.d.ts +24 -0
  150. package/node_modules/glob/dist/commonjs/ignore.d.ts.map +1 -0
  151. package/node_modules/glob/dist/commonjs/ignore.js +119 -0
  152. package/node_modules/glob/dist/commonjs/ignore.js.map +1 -0
  153. package/node_modules/glob/dist/commonjs/index.d.ts +97 -0
  154. package/node_modules/glob/dist/commonjs/index.d.ts.map +1 -0
  155. package/node_modules/glob/dist/commonjs/index.js +68 -0
  156. package/node_modules/glob/dist/commonjs/index.js.map +1 -0
  157. package/node_modules/glob/dist/commonjs/index.min.js +4 -0
  158. package/node_modules/glob/dist/commonjs/index.min.js.map +7 -0
  159. package/node_modules/glob/dist/commonjs/package.json +3 -0
  160. package/node_modules/glob/dist/commonjs/pattern.d.ts +79 -0
  161. package/node_modules/glob/dist/commonjs/pattern.d.ts.map +1 -0
  162. package/node_modules/glob/dist/commonjs/pattern.js +223 -0
  163. package/node_modules/glob/dist/commonjs/pattern.js.map +1 -0
  164. package/node_modules/glob/dist/commonjs/processor.d.ts +59 -0
  165. package/node_modules/glob/dist/commonjs/processor.d.ts.map +1 -0
  166. package/node_modules/glob/dist/commonjs/processor.js +301 -0
  167. package/node_modules/glob/dist/commonjs/processor.js.map +1 -0
  168. package/node_modules/glob/dist/commonjs/walker.d.ts +97 -0
  169. package/node_modules/glob/dist/commonjs/walker.d.ts.map +1 -0
  170. package/node_modules/glob/dist/commonjs/walker.js +387 -0
  171. package/node_modules/glob/dist/commonjs/walker.js.map +1 -0
  172. package/node_modules/glob/dist/esm/glob.d.ts +396 -0
  173. package/node_modules/glob/dist/esm/glob.d.ts.map +1 -0
  174. package/node_modules/glob/dist/esm/glob.js +244 -0
  175. package/node_modules/glob/dist/esm/glob.js.map +1 -0
  176. package/node_modules/glob/dist/esm/has-magic.d.ts +14 -0
  177. package/node_modules/glob/dist/esm/has-magic.d.ts.map +1 -0
  178. package/node_modules/glob/dist/esm/has-magic.js +23 -0
  179. package/node_modules/glob/dist/esm/has-magic.js.map +1 -0
  180. package/node_modules/glob/dist/esm/ignore.d.ts +24 -0
  181. package/node_modules/glob/dist/esm/ignore.d.ts.map +1 -0
  182. package/node_modules/glob/dist/esm/ignore.js +115 -0
  183. package/node_modules/glob/dist/esm/ignore.js.map +1 -0
  184. package/node_modules/glob/dist/esm/index.d.ts +97 -0
  185. package/node_modules/glob/dist/esm/index.d.ts.map +1 -0
  186. package/node_modules/glob/dist/esm/index.js +55 -0
  187. package/node_modules/glob/dist/esm/index.js.map +1 -0
  188. package/node_modules/glob/dist/esm/index.min.js +4 -0
  189. package/node_modules/glob/dist/esm/index.min.js.map +7 -0
  190. package/node_modules/glob/dist/esm/package.json +3 -0
  191. package/node_modules/glob/dist/esm/pattern.d.ts +79 -0
  192. package/node_modules/glob/dist/esm/pattern.d.ts.map +1 -0
  193. package/node_modules/glob/dist/esm/pattern.js +219 -0
  194. package/node_modules/glob/dist/esm/pattern.js.map +1 -0
  195. package/node_modules/glob/dist/esm/processor.d.ts +59 -0
  196. package/node_modules/glob/dist/esm/processor.d.ts.map +1 -0
  197. package/node_modules/glob/dist/esm/processor.js +294 -0
  198. package/node_modules/glob/dist/esm/processor.js.map +1 -0
  199. package/node_modules/glob/dist/esm/walker.d.ts +97 -0
  200. package/node_modules/glob/dist/esm/walker.d.ts.map +1 -0
  201. package/node_modules/glob/dist/esm/walker.js +381 -0
  202. package/node_modules/glob/dist/esm/walker.js.map +1 -0
  203. package/node_modules/glob/package.json +98 -0
  204. package/node_modules/has-flag/index.d.ts +39 -0
  205. package/node_modules/has-flag/index.js +8 -0
  206. package/node_modules/has-flag/license +9 -0
  207. package/node_modules/has-flag/package.json +46 -0
  208. package/node_modules/has-flag/readme.md +89 -0
  209. package/node_modules/ieee754/LICENSE +11 -0
  210. package/node_modules/ieee754/README.md +51 -0
  211. package/node_modules/ieee754/index.d.ts +10 -0
  212. package/node_modules/ieee754/index.js +85 -0
  213. package/node_modules/ieee754/package.json +52 -0
  214. package/node_modules/inherits/LICENSE +16 -0
  215. package/node_modules/inherits/README.md +42 -0
  216. package/node_modules/inherits/inherits.js +9 -0
  217. package/node_modules/inherits/inherits_browser.js +27 -0
  218. package/node_modules/inherits/package.json +29 -0
  219. package/node_modules/is-interactive/index.d.ts +31 -0
  220. package/node_modules/is-interactive/index.js +9 -0
  221. package/node_modules/is-interactive/license +9 -0
  222. package/node_modules/is-interactive/package.json +38 -0
  223. package/node_modules/is-interactive/readme.md +51 -0
  224. package/node_modules/is-unicode-supported/index.d.ts +14 -0
  225. package/node_modules/is-unicode-supported/index.js +13 -0
  226. package/node_modules/is-unicode-supported/license +9 -0
  227. package/node_modules/is-unicode-supported/package.json +41 -0
  228. package/node_modules/is-unicode-supported/readme.md +35 -0
  229. package/node_modules/log-symbols/browser.js +8 -0
  230. package/node_modules/log-symbols/index.d.ts +25 -0
  231. package/node_modules/log-symbols/index.js +19 -0
  232. package/node_modules/log-symbols/license +9 -0
  233. package/node_modules/log-symbols/package.json +52 -0
  234. package/node_modules/log-symbols/readme.md +51 -0
  235. package/node_modules/lru-cache/LICENSE.md +55 -0
  236. package/node_modules/lru-cache/README.md +383 -0
  237. package/node_modules/lru-cache/dist/commonjs/index.d.ts +1323 -0
  238. package/node_modules/lru-cache/dist/commonjs/index.d.ts.map +1 -0
  239. package/node_modules/lru-cache/dist/commonjs/index.js +1595 -0
  240. package/node_modules/lru-cache/dist/commonjs/index.js.map +1 -0
  241. package/node_modules/lru-cache/dist/commonjs/index.min.js +2 -0
  242. package/node_modules/lru-cache/dist/commonjs/index.min.js.map +7 -0
  243. package/node_modules/lru-cache/dist/commonjs/package.json +3 -0
  244. package/node_modules/lru-cache/dist/esm/index.d.ts +1323 -0
  245. package/node_modules/lru-cache/dist/esm/index.d.ts.map +1 -0
  246. package/node_modules/lru-cache/dist/esm/index.js +1591 -0
  247. package/node_modules/lru-cache/dist/esm/index.js.map +1 -0
  248. package/node_modules/lru-cache/dist/esm/index.min.js +2 -0
  249. package/node_modules/lru-cache/dist/esm/index.min.js.map +7 -0
  250. package/node_modules/lru-cache/dist/esm/package.json +3 -0
  251. package/node_modules/lru-cache/package.json +93 -0
  252. package/node_modules/mimic-fn/index.d.ts +54 -0
  253. package/node_modules/mimic-fn/index.js +13 -0
  254. package/node_modules/mimic-fn/license +9 -0
  255. package/node_modules/mimic-fn/package.json +42 -0
  256. package/node_modules/mimic-fn/readme.md +69 -0
  257. package/node_modules/minimatch/LICENSE.md +55 -0
  258. package/node_modules/minimatch/README.md +528 -0
  259. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
  260. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
  261. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  262. package/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
  263. package/node_modules/minimatch/dist/commonjs/ast.d.ts +22 -0
  264. package/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
  265. package/node_modules/minimatch/dist/commonjs/ast.js +846 -0
  266. package/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
  267. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
  268. package/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
  269. package/node_modules/minimatch/dist/commonjs/brace-expressions.js +150 -0
  270. package/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
  271. package/node_modules/minimatch/dist/commonjs/escape.d.ts +15 -0
  272. package/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
  273. package/node_modules/minimatch/dist/commonjs/escape.js +30 -0
  274. package/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
  275. package/node_modules/minimatch/dist/commonjs/index.d.ts +174 -0
  276. package/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
  277. package/node_modules/minimatch/dist/commonjs/index.js +1121 -0
  278. package/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
  279. package/node_modules/minimatch/dist/commonjs/package.json +3 -0
  280. package/node_modules/minimatch/dist/commonjs/unescape.d.ts +22 -0
  281. package/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
  282. package/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
  283. package/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
  284. package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
  285. package/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
  286. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
  287. package/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
  288. package/node_modules/minimatch/dist/esm/ast.d.ts +22 -0
  289. package/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
  290. package/node_modules/minimatch/dist/esm/ast.js +842 -0
  291. package/node_modules/minimatch/dist/esm/ast.js.map +1 -0
  292. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
  293. package/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
  294. package/node_modules/minimatch/dist/esm/brace-expressions.js +146 -0
  295. package/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
  296. package/node_modules/minimatch/dist/esm/escape.d.ts +15 -0
  297. package/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
  298. package/node_modules/minimatch/dist/esm/escape.js +26 -0
  299. package/node_modules/minimatch/dist/esm/escape.js.map +1 -0
  300. package/node_modules/minimatch/dist/esm/index.d.ts +174 -0
  301. package/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
  302. package/node_modules/minimatch/dist/esm/index.js +1108 -0
  303. package/node_modules/minimatch/dist/esm/index.js.map +1 -0
  304. package/node_modules/minimatch/dist/esm/package.json +3 -0
  305. package/node_modules/minimatch/dist/esm/unescape.d.ts +22 -0
  306. package/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
  307. package/node_modules/minimatch/dist/esm/unescape.js +34 -0
  308. package/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
  309. package/node_modules/minimatch/package.json +67 -0
  310. package/node_modules/minipass/LICENSE.md +55 -0
  311. package/node_modules/minipass/README.md +825 -0
  312. package/node_modules/minipass/dist/commonjs/index.d.ts +545 -0
  313. package/node_modules/minipass/dist/commonjs/index.d.ts.map +1 -0
  314. package/node_modules/minipass/dist/commonjs/index.js +1038 -0
  315. package/node_modules/minipass/dist/commonjs/index.js.map +1 -0
  316. package/node_modules/minipass/dist/commonjs/package.json +3 -0
  317. package/node_modules/minipass/dist/esm/index.d.ts +545 -0
  318. package/node_modules/minipass/dist/esm/index.d.ts.map +1 -0
  319. package/node_modules/minipass/dist/esm/index.js +1020 -0
  320. package/node_modules/minipass/dist/esm/index.js.map +1 -0
  321. package/node_modules/minipass/dist/esm/package.json +3 -0
  322. package/node_modules/minipass/package.json +77 -0
  323. package/node_modules/node-domexception/.history/README_20210527203617.md +2 -0
  324. package/node_modules/node-domexception/.history/README_20210527212714.md +41 -0
  325. package/node_modules/node-domexception/.history/README_20210527213345.md +36 -0
  326. package/node_modules/node-domexception/.history/README_20210527213411.md +36 -0
  327. package/node_modules/node-domexception/.history/README_20210527213803.md +36 -0
  328. package/node_modules/node-domexception/.history/README_20210527214323.md +38 -0
  329. package/node_modules/node-domexception/.history/README_20210527214408.md +38 -0
  330. package/node_modules/node-domexception/.history/index_20210527203842.js +0 -0
  331. package/node_modules/node-domexception/.history/index_20210527203947.js +8 -0
  332. package/node_modules/node-domexception/.history/index_20210527204259.js +9 -0
  333. package/node_modules/node-domexception/.history/index_20210527204418.js +9 -0
  334. package/node_modules/node-domexception/.history/index_20210527204756.js +11 -0
  335. package/node_modules/node-domexception/.history/index_20210527204833.js +11 -0
  336. package/node_modules/node-domexception/.history/index_20210527211208.js +15 -0
  337. package/node_modules/node-domexception/.history/index_20210527211248.js +15 -0
  338. package/node_modules/node-domexception/.history/index_20210527212722.js +23 -0
  339. package/node_modules/node-domexception/.history/index_20210527212731.js +23 -0
  340. package/node_modules/node-domexception/.history/index_20210527212746.js +15 -0
  341. package/node_modules/node-domexception/.history/index_20210527212900.js +16 -0
  342. package/node_modules/node-domexception/.history/index_20210527213022.js +16 -0
  343. package/node_modules/node-domexception/.history/index_20210527213822.js +16 -0
  344. package/node_modules/node-domexception/.history/index_20210527213843.js +17 -0
  345. package/node_modules/node-domexception/.history/index_20210527213852.js +17 -0
  346. package/node_modules/node-domexception/.history/index_20210527213910.js +16 -0
  347. package/node_modules/node-domexception/.history/index_20210527214034.js +16 -0
  348. package/node_modules/node-domexception/.history/index_20210527214643.js +41 -0
  349. package/node_modules/node-domexception/.history/index_20210527214654.js +41 -0
  350. package/node_modules/node-domexception/.history/index_20210527214700.js +16 -0
  351. package/node_modules/node-domexception/.history/package_20210527203733.json +19 -0
  352. package/node_modules/node-domexception/.history/package_20210527203825.json +16 -0
  353. package/node_modules/node-domexception/.history/package_20210527204621.json +19 -0
  354. package/node_modules/node-domexception/.history/package_20210527204913.json +25 -0
  355. package/node_modules/node-domexception/.history/package_20210527204925.json +25 -0
  356. package/node_modules/node-domexception/.history/package_20210527205145.json +29 -0
  357. package/node_modules/node-domexception/.history/package_20210527205156.json +29 -0
  358. package/node_modules/node-domexception/.history/test_20210527205603.js +0 -0
  359. package/node_modules/node-domexception/.history/test_20210527205957.js +3 -0
  360. package/node_modules/node-domexception/.history/test_20210527210021.js +3 -0
  361. package/node_modules/node-domexception/LICENSE +21 -0
  362. package/node_modules/node-domexception/README.md +46 -0
  363. package/node_modules/node-domexception/index.js +16 -0
  364. package/node_modules/node-domexception/package.json +29 -0
  365. package/node_modules/node-fetch/@types/index.d.ts +219 -0
  366. package/node_modules/node-fetch/LICENSE.md +22 -0
  367. package/node_modules/node-fetch/README.md +872 -0
  368. package/node_modules/node-fetch/package.json +131 -0
  369. package/node_modules/node-fetch/src/body.js +397 -0
  370. package/node_modules/node-fetch/src/errors/abort-error.js +10 -0
  371. package/node_modules/node-fetch/src/errors/base.js +17 -0
  372. package/node_modules/node-fetch/src/errors/fetch-error.js +26 -0
  373. package/node_modules/node-fetch/src/headers.js +267 -0
  374. package/node_modules/node-fetch/src/index.js +417 -0
  375. package/node_modules/node-fetch/src/request.js +313 -0
  376. package/node_modules/node-fetch/src/response.js +160 -0
  377. package/node_modules/node-fetch/src/utils/get-search.js +9 -0
  378. package/node_modules/node-fetch/src/utils/is-redirect.js +11 -0
  379. package/node_modules/node-fetch/src/utils/is.js +87 -0
  380. package/node_modules/node-fetch/src/utils/multipart-parser.js +432 -0
  381. package/node_modules/node-fetch/src/utils/referrer.js +340 -0
  382. package/node_modules/onetime/index.d.ts +64 -0
  383. package/node_modules/onetime/index.js +44 -0
  384. package/node_modules/onetime/license +9 -0
  385. package/node_modules/onetime/package.json +43 -0
  386. package/node_modules/onetime/readme.md +94 -0
  387. package/node_modules/ora/index.d.ts +277 -0
  388. package/node_modules/ora/index.js +407 -0
  389. package/node_modules/ora/license +9 -0
  390. package/node_modules/ora/package.json +57 -0
  391. package/node_modules/ora/readme.md +264 -0
  392. package/node_modules/path-scurry/LICENSE.md +55 -0
  393. package/node_modules/path-scurry/README.md +636 -0
  394. package/node_modules/path-scurry/dist/commonjs/index.d.ts +1115 -0
  395. package/node_modules/path-scurry/dist/commonjs/index.d.ts.map +1 -0
  396. package/node_modules/path-scurry/dist/commonjs/index.js +2018 -0
  397. package/node_modules/path-scurry/dist/commonjs/index.js.map +1 -0
  398. package/node_modules/path-scurry/dist/commonjs/package.json +3 -0
  399. package/node_modules/path-scurry/dist/esm/index.d.ts +1115 -0
  400. package/node_modules/path-scurry/dist/esm/index.d.ts.map +1 -0
  401. package/node_modules/path-scurry/dist/esm/index.js +1983 -0
  402. package/node_modules/path-scurry/dist/esm/index.js.map +1 -0
  403. package/node_modules/path-scurry/dist/esm/package.json +3 -0
  404. package/node_modules/path-scurry/package.json +72 -0
  405. package/node_modules/readable-stream/CONTRIBUTING.md +38 -0
  406. package/node_modules/readable-stream/GOVERNANCE.md +136 -0
  407. package/node_modules/readable-stream/LICENSE +47 -0
  408. package/node_modules/readable-stream/README.md +106 -0
  409. package/node_modules/readable-stream/errors-browser.js +127 -0
  410. package/node_modules/readable-stream/errors.js +116 -0
  411. package/node_modules/readable-stream/experimentalWarning.js +17 -0
  412. package/node_modules/readable-stream/lib/_stream_duplex.js +126 -0
  413. package/node_modules/readable-stream/lib/_stream_passthrough.js +37 -0
  414. package/node_modules/readable-stream/lib/_stream_readable.js +1027 -0
  415. package/node_modules/readable-stream/lib/_stream_transform.js +190 -0
  416. package/node_modules/readable-stream/lib/_stream_writable.js +641 -0
  417. package/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
  418. package/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
  419. package/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
  420. package/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
  421. package/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
  422. package/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
  423. package/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
  424. package/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
  425. package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
  426. package/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
  427. package/node_modules/readable-stream/package.json +68 -0
  428. package/node_modules/readable-stream/readable-browser.js +9 -0
  429. package/node_modules/readable-stream/readable.js +16 -0
  430. package/node_modules/restore-cursor/index.d.ts +13 -0
  431. package/node_modules/restore-cursor/index.js +9 -0
  432. package/node_modules/restore-cursor/license +9 -0
  433. package/node_modules/restore-cursor/package.json +52 -0
  434. package/node_modules/restore-cursor/readme.md +26 -0
  435. package/node_modules/safe-buffer/LICENSE +21 -0
  436. package/node_modules/safe-buffer/README.md +584 -0
  437. package/node_modules/safe-buffer/index.d.ts +187 -0
  438. package/node_modules/safe-buffer/index.js +65 -0
  439. package/node_modules/safe-buffer/package.json +51 -0
  440. package/node_modules/signal-exit/LICENSE.txt +16 -0
  441. package/node_modules/signal-exit/README.md +39 -0
  442. package/node_modules/signal-exit/index.js +202 -0
  443. package/node_modules/signal-exit/package.json +38 -0
  444. package/node_modules/signal-exit/signals.js +53 -0
  445. package/node_modules/string_decoder/LICENSE +48 -0
  446. package/node_modules/string_decoder/README.md +47 -0
  447. package/node_modules/string_decoder/lib/string_decoder.js +296 -0
  448. package/node_modules/string_decoder/package.json +34 -0
  449. package/node_modules/strip-ansi/index.d.ts +17 -0
  450. package/node_modules/strip-ansi/index.js +4 -0
  451. package/node_modules/strip-ansi/license +9 -0
  452. package/node_modules/strip-ansi/package.json +54 -0
  453. package/node_modules/strip-ansi/readme.md +46 -0
  454. package/node_modules/supports-color/browser.js +5 -0
  455. package/node_modules/supports-color/index.js +135 -0
  456. package/node_modules/supports-color/license +9 -0
  457. package/node_modules/supports-color/package.json +53 -0
  458. package/node_modules/supports-color/readme.md +76 -0
  459. package/node_modules/util-deprecate/History.md +16 -0
  460. package/node_modules/util-deprecate/LICENSE +24 -0
  461. package/node_modules/util-deprecate/README.md +53 -0
  462. package/node_modules/util-deprecate/browser.js +67 -0
  463. package/node_modules/util-deprecate/node.js +6 -0
  464. package/node_modules/util-deprecate/package.json +27 -0
  465. package/node_modules/wcwidth/.npmignore +1 -0
  466. package/node_modules/wcwidth/LICENSE +30 -0
  467. package/node_modules/wcwidth/Readme.md +33 -0
  468. package/node_modules/wcwidth/combining.js +50 -0
  469. package/node_modules/wcwidth/docs/index.md +65 -0
  470. package/node_modules/wcwidth/index.js +99 -0
  471. package/node_modules/wcwidth/package.json +42 -0
  472. package/node_modules/wcwidth/test/index.js +64 -0
  473. package/node_modules/web-streams-polyfill/LICENSE +22 -0
  474. package/node_modules/web-streams-polyfill/README.md +110 -0
  475. package/node_modules/web-streams-polyfill/dist/polyfill.es2018.js +4765 -0
  476. package/node_modules/web-streams-polyfill/dist/polyfill.es2018.js.map +1 -0
  477. package/node_modules/web-streams-polyfill/dist/polyfill.es2018.min.js +9 -0
  478. package/node_modules/web-streams-polyfill/dist/polyfill.es2018.min.js.map +1 -0
  479. package/node_modules/web-streams-polyfill/dist/polyfill.es2018.mjs +4745 -0
  480. package/node_modules/web-streams-polyfill/dist/polyfill.es2018.mjs.map +1 -0
  481. package/node_modules/web-streams-polyfill/dist/polyfill.es6.js +4838 -0
  482. package/node_modules/web-streams-polyfill/dist/polyfill.es6.js.map +1 -0
  483. package/node_modules/web-streams-polyfill/dist/polyfill.es6.min.js +9 -0
  484. package/node_modules/web-streams-polyfill/dist/polyfill.es6.min.js.map +1 -0
  485. package/node_modules/web-streams-polyfill/dist/polyfill.es6.mjs +4818 -0
  486. package/node_modules/web-streams-polyfill/dist/polyfill.es6.mjs.map +1 -0
  487. package/node_modules/web-streams-polyfill/dist/polyfill.js +5011 -0
  488. package/node_modules/web-streams-polyfill/dist/polyfill.js.map +1 -0
  489. package/node_modules/web-streams-polyfill/dist/polyfill.min.js +9 -0
  490. package/node_modules/web-streams-polyfill/dist/polyfill.min.js.map +1 -0
  491. package/node_modules/web-streams-polyfill/dist/polyfill.mjs +4991 -0
  492. package/node_modules/web-streams-polyfill/dist/polyfill.mjs.map +1 -0
  493. package/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js +4737 -0
  494. package/node_modules/web-streams-polyfill/dist/ponyfill.es2018.js.map +1 -0
  495. package/node_modules/web-streams-polyfill/dist/ponyfill.es2018.mjs +4717 -0
  496. package/node_modules/web-streams-polyfill/dist/ponyfill.es2018.mjs.map +1 -0
  497. package/node_modules/web-streams-polyfill/dist/ponyfill.es6.js +4810 -0
  498. package/node_modules/web-streams-polyfill/dist/ponyfill.es6.js.map +1 -0
  499. package/node_modules/web-streams-polyfill/dist/ponyfill.es6.mjs +4790 -0
  500. package/node_modules/web-streams-polyfill/dist/ponyfill.es6.mjs.map +1 -0
  501. package/node_modules/web-streams-polyfill/dist/ponyfill.js +4983 -0
  502. package/node_modules/web-streams-polyfill/dist/ponyfill.js.map +1 -0
  503. package/node_modules/web-streams-polyfill/dist/ponyfill.mjs +4963 -0
  504. package/node_modules/web-streams-polyfill/dist/ponyfill.mjs.map +1 -0
  505. package/node_modules/web-streams-polyfill/dist/types/polyfill.d.ts +24 -0
  506. package/node_modules/web-streams-polyfill/dist/types/ponyfill.d.ts +780 -0
  507. package/node_modules/web-streams-polyfill/dist/types/ts3.6/polyfill.d.ts +28 -0
  508. package/node_modules/web-streams-polyfill/dist/types/ts3.6/ponyfill.d.ts +821 -0
  509. package/node_modules/web-streams-polyfill/dist/types/tsdoc-metadata.json +11 -0
  510. package/node_modules/web-streams-polyfill/es2018/package.json +14 -0
  511. package/node_modules/web-streams-polyfill/es6/package.json +14 -0
  512. package/node_modules/web-streams-polyfill/package.json +83 -0
  513. package/node_modules/web-streams-polyfill/ponyfill/es2018/package.json +13 -0
  514. package/node_modules/web-streams-polyfill/ponyfill/es6/package.json +13 -0
  515. package/node_modules/web-streams-polyfill/ponyfill/package.json +13 -0
  516. package/package.json +26 -0
  517. package/version.json +18 -0
@@ -0,0 +1,1176 @@
1
+ # Commander.js
2
+
3
+ [![Build Status](https://github.com/tj/commander.js/workflows/build/badge.svg)](https://github.com/tj/commander.js/actions?query=workflow%3A%22build%22)
4
+ [![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
5
+ [![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://npmcharts.com/compare/commander?minimal=true)
6
+ [![Install Size](https://packagephobia.now.sh/badge?p=commander)](https://packagephobia.now.sh/result?p=commander)
7
+
8
+ The complete solution for [node.js](http://nodejs.org) command-line interfaces.
9
+
10
+ Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
11
+
12
+ - [Commander.js](#commanderjs)
13
+ - [Installation](#installation)
14
+ - [Quick Start](#quick-start)
15
+ - [Declaring _program_ variable](#declaring-program-variable)
16
+ - [Options](#options)
17
+ - [Common option types, boolean and value](#common-option-types-boolean-and-value)
18
+ - [Default option value](#default-option-value)
19
+ - [Other option types, negatable boolean and boolean|value](#other-option-types-negatable-boolean-and-booleanvalue)
20
+ - [Required option](#required-option)
21
+ - [Variadic option](#variadic-option)
22
+ - [Version option](#version-option)
23
+ - [More configuration](#more-configuration)
24
+ - [Custom option processing](#custom-option-processing)
25
+ - [Commands](#commands)
26
+ - [Command-arguments](#command-arguments)
27
+ - [More configuration](#more-configuration-1)
28
+ - [Custom argument processing](#custom-argument-processing)
29
+ - [Action handler](#action-handler)
30
+ - [Stand-alone executable (sub)commands](#stand-alone-executable-subcommands)
31
+ - [Life cycle hooks](#life-cycle-hooks)
32
+ - [Automated help](#automated-help)
33
+ - [Custom help](#custom-help)
34
+ - [Display help after errors](#display-help-after-errors)
35
+ - [Display help from code](#display-help-from-code)
36
+ - [.name](#name)
37
+ - [.usage](#usage)
38
+ - [.description and .summary](#description-and-summary)
39
+ - [.helpOption(flags, description)](#helpoptionflags-description)
40
+ - [.helpCommand()](#helpcommand)
41
+ - [Help Groups](#help-groups)
42
+ - [More configuration](#more-configuration-2)
43
+ - [Custom event listeners](#custom-event-listeners)
44
+ - [Bits and pieces](#bits-and-pieces)
45
+ - [.parse() and .parseAsync()](#parse-and-parseasync)
46
+ - [Parsing Configuration](#parsing-configuration)
47
+ - [Legacy options as properties](#legacy-options-as-properties)
48
+ - [TypeScript](#typescript)
49
+ - [createCommand()](#createcommand)
50
+ - [Node options such as `--harmony`](#node-options-such-as---harmony)
51
+ - [Debugging stand-alone executable subcommands](#debugging-stand-alone-executable-subcommands)
52
+ - [npm run-script](#npm-run-script)
53
+ - [Display error](#display-error)
54
+ - [Override exit and output handling](#override-exit-and-output-handling)
55
+ - [Additional documentation](#additional-documentation)
56
+ - [Support](#support)
57
+ - [Commander for enterprise](#commander-for-enterprise)
58
+
59
+ For information about terms used in this document see: [terminology](./docs/terminology.md)
60
+
61
+ ## Installation
62
+
63
+ ```sh
64
+ npm install commander
65
+ ```
66
+
67
+ ## Quick Start
68
+
69
+ You write code to describe your command line interface.
70
+ Commander looks after parsing the arguments into options and command-arguments,
71
+ displays usage errors for problems, and implements a help system.
72
+
73
+ Commander is strict and displays an error for unrecognised options.
74
+ The two most used option types are a boolean option, and an option which takes its value from the following argument.
75
+
76
+ Example file: [split.js](./examples/split.js)
77
+
78
+ ```js
79
+ const { program } = require('commander');
80
+
81
+ program
82
+ .option('--first')
83
+ .option('-s, --separator <char>')
84
+ .argument('<string>');
85
+
86
+ program.parse();
87
+
88
+ const options = program.opts();
89
+ const limit = options.first ? 1 : undefined;
90
+ console.log(program.args[0].split(options.separator, limit));
91
+ ```
92
+
93
+ ```console
94
+ $ node split.js -s / --fits a/b/c
95
+ error: unknown option '--fits'
96
+ (Did you mean --first?)
97
+ $ node split.js -s / --first a/b/c
98
+ [ 'a' ]
99
+ ```
100
+
101
+ Here is a more complete program using a subcommand and with descriptions for the help. In a multi-command program, you have an action handler for each command (or stand-alone executables for the commands).
102
+
103
+ Example file: [string-util.js](./examples/string-util.js)
104
+
105
+ ```js
106
+ const { Command } = require('commander');
107
+ const program = new Command();
108
+
109
+ program
110
+ .name('string-util')
111
+ .description('CLI to some JavaScript string utilities')
112
+ .version('0.8.0');
113
+
114
+ program.command('split')
115
+ .description('Split a string into substrings and display as an array')
116
+ .argument('<string>', 'string to split')
117
+ .option('--first', 'display just the first substring')
118
+ .option('-s, --separator <char>', 'separator character', ',')
119
+ .action((str, options) => {
120
+ const limit = options.first ? 1 : undefined;
121
+ console.log(str.split(options.separator, limit));
122
+ });
123
+
124
+ program.parse();
125
+ ```
126
+
127
+ ```console
128
+ $ node string-util.js help split
129
+ Usage: string-util split [options] <string>
130
+
131
+ Split a string into substrings and display as an array.
132
+
133
+ Arguments:
134
+ string string to split
135
+
136
+ Options:
137
+ --first display just the first substring
138
+ -s, --separator <char> separator character (default: ",")
139
+ -h, --help display help for command
140
+
141
+ $ node string-util.js split --separator=/ a/b/c
142
+ [ 'a', 'b', 'c' ]
143
+ ```
144
+
145
+ More samples can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.
146
+
147
+ ## Declaring _program_ variable
148
+
149
+ Commander exports a global object which is convenient for quick programs.
150
+ This is used in the examples in this README for brevity.
151
+
152
+ ```js
153
+ // CommonJS (.cjs)
154
+ const { program } = require('commander');
155
+ ```
156
+
157
+ For larger programs which may use commander in multiple ways, including unit testing, it is better to create a local `Command` object to use.
158
+
159
+ ```js
160
+ // CommonJS (.cjs)
161
+ const { Command } = require('commander');
162
+ const program = new Command();
163
+ ```
164
+
165
+ ```js
166
+ // ECMAScript (.mjs)
167
+ import { Command } from 'commander';
168
+ const program = new Command();
169
+ ```
170
+
171
+ ```ts
172
+ // TypeScript (.ts)
173
+ import { Command } from 'commander';
174
+ const program = new Command();
175
+ ```
176
+
177
+ ## Options
178
+
179
+ Options are defined with the `.option()` method, also serving as documentation for the options. Each option can have a short flag (single character) and a long name, separated by a comma, a space, or a vertical bar (`|`). To allow a wider range of short-ish flags than just single characters, you may also have two long options.
180
+
181
+ ```js
182
+ program
183
+ .option('-p, --port <number>', 'server port number')
184
+ .option('--trace', 'add extra debugging output')
185
+ .option('--ws, --workspace <name>', 'use a custom workspace')
186
+ ```
187
+
188
+ The parsed options can be accessed by calling `.opts()` on a `Command` object, and are passed to the action handler.
189
+
190
+ Multi-word options like `--template-engine` are normalized to camelCase option names, resulting in properties such as `program.opts().templateEngine`.
191
+
192
+ An option and its option-argument can be separated by a space, or combined into the same argument. The option-argument can follow the short option directly, or follow an `=` for a long option.
193
+
194
+ ```sh
195
+ serve -p 80
196
+ serve -p80
197
+ serve --port 80
198
+ serve --port=80
199
+ ```
200
+
201
+ You can use `--` to indicate the end of the options, and any remaining arguments will be used without being interpreted.
202
+
203
+ By default, options on the command line are not positional, and can be specified before or after other arguments.
204
+
205
+ There are additional related routines for when `.opts()` is not enough:
206
+
207
+ - `.optsWithGlobals()` returns merged local and global option values
208
+ - `.getOptionValue()` and `.setOptionValue()` work with a single option value
209
+ - `.getOptionValueSource()` and `.setOptionValueWithSource()` include where the option value came from
210
+
211
+ ### Common option types, boolean and value
212
+
213
+ The two most used option types are a boolean option, and an option which takes its value
214
+ from the following argument (declared with angle brackets like `--expect <value>`). Both are `undefined` unless specified on command line.
215
+
216
+ Example file: [options-common.js](./examples/options-common.js)
217
+
218
+ ```js
219
+ program
220
+ .option('-d, --debug', 'output extra debugging')
221
+ .option('-s, --small', 'small pizza size')
222
+ .option('-p, --pizza-type <type>', 'flavour of pizza');
223
+
224
+ program.parse(process.argv);
225
+
226
+ const options = program.opts();
227
+ if (options.debug) console.log(options);
228
+ console.log('pizza details:');
229
+ if (options.small) console.log('- small pizza size');
230
+ if (options.pizzaType) console.log(`- ${options.pizzaType}`);
231
+ ```
232
+
233
+ ```console
234
+ $ pizza-options -p
235
+ error: option '-p, --pizza-type <type>' argument missing
236
+ $ pizza-options -d -s -p vegetarian
237
+ { debug: true, small: true, pizzaType: 'vegetarian' }
238
+ pizza details:
239
+ - small pizza size
240
+ - vegetarian
241
+ $ pizza-options --pizza-type=cheese
242
+ pizza details:
243
+ - cheese
244
+ ```
245
+
246
+ Multiple boolean short options may be combined following the dash, and may be followed by a single short option taking a value.
247
+ For example, `-d -s -p cheese` may be written as `-ds -p cheese` or even `-dsp cheese`.
248
+
249
+ Options with an expected option-argument are greedy and will consume the following argument whatever the value.
250
+ So `--id -xyz` reads `-xyz` as the option-argument.
251
+
252
+ `program.parse(arguments)` processes the arguments, leaving any args not consumed by the program options in the `program.args` array. The parameter is optional and defaults to `process.argv`.
253
+
254
+ ### Default option value
255
+
256
+ You can specify a default value for an option.
257
+
258
+ Example file: [options-defaults.js](./examples/options-defaults.js)
259
+
260
+ ```js
261
+ program
262
+ .option('-c, --cheese <type>', 'add the specified type of cheese', 'blue');
263
+
264
+ program.parse();
265
+
266
+ console.log(`cheese: ${program.opts().cheese}`);
267
+ ```
268
+
269
+ ```console
270
+ $ pizza-options
271
+ cheese: blue
272
+ $ pizza-options --cheese stilton
273
+ cheese: stilton
274
+ ```
275
+
276
+ ### Other option types, negatable boolean and boolean|value
277
+
278
+ You can define a boolean option long name with a leading `no-` to set the option value to `false` when used.
279
+ Defined alone, this also makes the option `true` by default.
280
+
281
+ If you define `--foo` first, adding `--no-foo` does not change the default value from what it would
282
+ otherwise be.
283
+
284
+ Example file: [options-negatable.js](./examples/options-negatable.js)
285
+
286
+ ```js
287
+ program
288
+ .option('--no-sauce', 'Remove sauce')
289
+ .option('--cheese <flavour>', 'cheese flavour', 'mozzarella')
290
+ .option('--no-cheese', 'plain with no cheese')
291
+ .parse();
292
+
293
+ const options = program.opts();
294
+ const sauceStr = options.sauce ? 'sauce' : 'no sauce';
295
+ const cheeseStr = (options.cheese === false) ? 'no cheese' : `${options.cheese} cheese`;
296
+ console.log(`You ordered a pizza with ${sauceStr} and ${cheeseStr}`);
297
+ ```
298
+
299
+ ```console
300
+ $ pizza-options
301
+ You ordered a pizza with sauce and mozzarella cheese
302
+ $ pizza-options --sauce
303
+ error: unknown option '--sauce'
304
+ $ pizza-options --cheese=blue
305
+ You ordered a pizza with sauce and blue cheese
306
+ $ pizza-options --no-sauce --no-cheese
307
+ You ordered a pizza with no sauce and no cheese
308
+ ```
309
+
310
+ You can specify an option which may be used as a boolean option but may optionally take an option-argument
311
+ (declared with square brackets, like `--optional [value]`).
312
+
313
+ Example file: [options-boolean-or-value.js](./examples/options-boolean-or-value.js)
314
+
315
+ ```js
316
+ program
317
+ .option('-c, --cheese [type]', 'Add cheese with optional type');
318
+
319
+ program.parse(process.argv);
320
+
321
+ const options = program.opts();
322
+ if (options.cheese === undefined) console.log('no cheese');
323
+ else if (options.cheese === true) console.log('add cheese');
324
+ else console.log(`add cheese type ${options.cheese}`);
325
+ ```
326
+
327
+ ```console
328
+ $ pizza-options
329
+ no cheese
330
+ $ pizza-options --cheese
331
+ add cheese
332
+ $ pizza-options --cheese mozzarella
333
+ add cheese type mozzarella
334
+ ```
335
+
336
+ Options with an optional option-argument are not greedy and will ignore arguments starting with a dash.
337
+ So `id` behaves as a boolean option for `--id -ABCD`, but you can use a combined form if needed like `--id=-ABCD`.
338
+ Negative numbers are special and are accepted as an option-argument.
339
+
340
+ For information about possible ambiguous cases, see [options taking varying arguments](./docs/options-in-depth.md).
341
+
342
+ ### Required option
343
+
344
+ You may specify a required (mandatory) option using `.requiredOption()`. The option must have a value after parsing, usually specified on the command line, or perhaps from a default value (e.g., from environment).
345
+
346
+ The method is otherwise the same as `.option()` in format, taking flags and description, and optional default value or custom processing.
347
+
348
+ Example file: [options-required.js](./examples/options-required.js)
349
+
350
+ ```js
351
+ program
352
+ .requiredOption('-c, --cheese <type>', 'pizza must have cheese');
353
+
354
+ program.parse();
355
+ ```
356
+
357
+ ```console
358
+ $ pizza
359
+ error: required option '-c, --cheese <type>' not specified
360
+ ```
361
+
362
+ ### Variadic option
363
+
364
+ You may make an option variadic by appending `...` to the value placeholder when declaring the option. On the command line you
365
+ can then specify multiple option-arguments, and the parsed option value will be an array. The extra arguments
366
+ are read until the first argument starting with a dash. The special argument `--` stops option processing entirely. If a value
367
+ is specified in the same argument as the option, then no further values are read.
368
+
369
+ Example file: [options-variadic.js](./examples/options-variadic.js)
370
+
371
+ ```js
372
+ program
373
+ .option('-n, --number <numbers...>', 'specify numbers')
374
+ .option('-l, --letter [letters...]', 'specify letters');
375
+
376
+ program.parse();
377
+
378
+ console.log('Options: ', program.opts());
379
+ console.log('Remaining arguments: ', program.args);
380
+ ```
381
+
382
+ ```console
383
+ $ collect -n 1 2 3 --letter a b c
384
+ Options: { number: [ '1', '2', '3' ], letter: [ 'a', 'b', 'c' ] }
385
+ Remaining arguments: []
386
+ $ collect --letter=A -n80 operand
387
+ Options: { number: [ '80' ], letter: [ 'A' ] }
388
+ Remaining arguments: [ 'operand' ]
389
+ $ collect --letter -n 1 -n 2 3 -- operand
390
+ Options: { number: [ '1', '2', '3' ], letter: true }
391
+ Remaining arguments: [ 'operand' ]
392
+ ```
393
+
394
+ For information about possible ambiguous cases, see [options taking varying arguments](./docs/options-in-depth.md).
395
+
396
+ ### Version option
397
+
398
+ The optional `.version()` method adds handling for displaying the command version. The default option flags are `-V` and `--version`. When used, the command prints the version number and exits.
399
+
400
+ ```js
401
+ program.version('0.0.1');
402
+ ```
403
+
404
+ ```console
405
+ $ ./examples/pizza -V
406
+ 0.0.1
407
+ ```
408
+
409
+ You may change the flags and description by passing additional parameters to the `.version()` method, using
410
+ the same syntax for flags as the `.option()` method.
411
+
412
+ ```js
413
+ program.version('0.0.1', '-v, --vers', 'output the current version');
414
+ ```
415
+
416
+ ### More configuration
417
+
418
+ You can add most options using the `.option()` method, but there are some additional features available
419
+ by constructing an `Option` explicitly for less common cases.
420
+
421
+ Example files: [options-extra.js](./examples/options-extra.js), [options-env.js](./examples/options-env.js), [options-conflicts.js](./examples/options-conflicts.js), [options-implies.js](./examples/options-implies.js)
422
+
423
+ ```js
424
+ program
425
+ .addOption(new Option('-s, --secret').hideHelp())
426
+ .addOption(new Option('-t, --timeout <delay>', 'timeout in seconds').default(60, 'one minute'))
427
+ .addOption(new Option('-d, --drink <size>', 'drink size').choices(['small', 'medium', 'large']))
428
+ .addOption(new Option('-p, --port <number>', 'port number').env('PORT'))
429
+ .addOption(new Option('--donate [amount]', 'optional donation in dollars').preset('20').argParser(parseFloat))
430
+ .addOption(new Option('--disable-server', 'disables the server').conflicts('port'))
431
+ .addOption(new Option('--free-drink', 'small drink included free ').implies({ drink: 'small' }));
432
+ ```
433
+
434
+ ```console
435
+ $ extra --help
436
+ Usage: help [options]
437
+
438
+ Options:
439
+ -t, --timeout <delay> timeout in seconds (default: one minute)
440
+ -d, --drink <size> drink cup size (choices: "small", "medium", "large")
441
+ -p, --port <number> port number (env: PORT)
442
+ --donate [amount] optional donation in dollars (preset: "20")
443
+ --disable-server disables the server
444
+ --free-drink small drink included free
445
+ -h, --help display help for command
446
+
447
+ $ extra --drink huge
448
+ error: option '-d, --drink <size>' argument 'huge' is invalid. Allowed choices are small, medium, large.
449
+
450
+ $ PORT=80 extra --donate --free-drink
451
+ Options: { timeout: 60, donate: 20, port: '80', freeDrink: true, drink: 'small' }
452
+
453
+ $ extra --disable-server --port 8000
454
+ error: option '--disable-server' cannot be used with option '-p, --port <number>'
455
+ ```
456
+
457
+ Specify a required (mandatory) option using the `Option` method `.makeOptionMandatory()`. This matches the `Command` method [`.requiredOption()`](#required-option).
458
+
459
+ ### Custom option processing
460
+
461
+ You may specify a function to do custom processing of option-arguments. The callback function receives two parameters,
462
+ the user specified option-argument and the previous value for the option. It returns the new value for the option.
463
+
464
+ This allows you to coerce the option-argument to the desired type, or accumulate values, or do entirely custom processing.
465
+
466
+ You can optionally specify the default/starting value for the option after the function parameter.
467
+
468
+ Example file: [options-custom-processing.js](./examples/options-custom-processing.js)
469
+
470
+ ```js
471
+ function myParseInt(value, dummyPrevious) {
472
+ // parseInt takes a string and a radix
473
+ const parsedValue = parseInt(value, 10);
474
+ if (isNaN(parsedValue)) {
475
+ throw new commander.InvalidArgumentError('Not a number.');
476
+ }
477
+ return parsedValue;
478
+ }
479
+
480
+ function increaseVerbosity(dummyValue, previous) {
481
+ return previous + 1;
482
+ }
483
+
484
+ function collect(value, previous) {
485
+ return previous.concat([value]);
486
+ }
487
+
488
+ function commaSeparatedList(value, dummyPrevious) {
489
+ return value.split(',');
490
+ }
491
+
492
+ program
493
+ .option('-f, --float <number>', 'float argument', parseFloat)
494
+ .option('-i, --integer <number>', 'integer argument', myParseInt)
495
+ .option('-v, --verbose', 'verbosity that can be increased', increaseVerbosity, 0)
496
+ .option('-c, --collect <value>', 'repeatable value', collect, [])
497
+ .option('-l, --list <items>', 'comma separated list', commaSeparatedList)
498
+ ;
499
+
500
+ program.parse();
501
+
502
+ const options = program.opts();
503
+ if (options.float !== undefined) console.log(`float: ${options.float}`);
504
+ if (options.integer !== undefined) console.log(`integer: ${options.integer}`);
505
+ if (options.verbose > 0) console.log(`verbosity: ${options.verbose}`);
506
+ if (options.collect.length > 0) console.log(options.collect);
507
+ if (options.list !== undefined) console.log(options.list);
508
+ ```
509
+
510
+ ```console
511
+ $ custom -f 1e2
512
+ float: 100
513
+ $ custom --integer 2
514
+ integer: 2
515
+ $ custom -v -v -v
516
+ verbose: 3
517
+ $ custom -c a -c b -c c
518
+ [ 'a', 'b', 'c' ]
519
+ $ custom --list x,y,z
520
+ [ 'x', 'y', 'z' ]
521
+ ```
522
+
523
+ ## Commands
524
+
525
+ You can specify (sub)commands using `.command()` or `.addCommand()`. There are two ways these can be implemented: using an `.action()` handler attached to the command; or as a stand-alone executable file. (More detail about this later.)
526
+
527
+ Subcommands may be nested. Example file: [nestedCommands.js](./examples/nestedCommands.js).
528
+
529
+ In the first parameter to `.command()` you specify the command name. You may append the command-arguments after the command name, or specify them separately using `.argument()`. The arguments may be `<required>` or `[optional]`, and the last argument may also be `variadic...`.
530
+
531
+ You can use `.addCommand()` to add an already configured subcommand to the program.
532
+
533
+ For example:
534
+
535
+ ```js
536
+ // Command implemented using action handler (description is supplied separately to `.command`)
537
+ // Returns new command for configuring.
538
+ program
539
+ .command('clone <source> [destination]')
540
+ .description('clone a repository into a newly created directory')
541
+ .action((source, destination) => {
542
+ console.log('clone command called');
543
+ });
544
+
545
+ // Command implemented using stand-alone executable file, indicated by adding description as second parameter to `.command`.
546
+ // Returns `this` for adding more commands.
547
+ program
548
+ .command('start <service>', 'start named service')
549
+ .command('stop [service]', 'stop named service, or all if no name supplied');
550
+
551
+ // Command prepared separately.
552
+ // Returns `this` for adding more commands.
553
+ program
554
+ .addCommand(build.makeBuildCommand());
555
+ ```
556
+
557
+ Configuration options can be passed with the call to `.command()` and `.addCommand()`. Specifying `hidden: true` will
558
+ remove the command from the generated help output. Specifying `isDefault: true` will run the subcommand if no other
559
+ subcommand is specified. (Example file: [defaultCommand.js](./examples/defaultCommand.js).)
560
+
561
+ You can add alternative names for a command with `.alias()`. (Example file: [alias.js](./examples/alias.js).)
562
+
563
+ `.command()` automatically copies the inherited settings from the parent command to the newly created subcommand. This is only done during creation; any later setting changes to the parent are not inherited.
564
+
565
+ For safety, `.addCommand()` does not automatically copy the inherited settings from the parent command. There is a helper routine `.copyInheritedSettings()` for copying the settings when they are wanted.
566
+
567
+ ### Command-arguments
568
+
569
+ For subcommands, you can specify the argument syntax in the call to `.command()` (as shown above). This
570
+ is the only method usable for subcommands implemented using a stand-alone executable.
571
+
572
+ Alternatively, you can instead use the following method. To configure a command, you can use `.argument()` to specify each expected command-argument.
573
+ You supply the argument name and an optional description. The argument may be `<required>` or `[optional]`.
574
+ You can specify a default value for an optional command-argument.
575
+
576
+ Example file: [argument.js](./examples/argument.js)
577
+
578
+ ```js
579
+ program
580
+ .version('0.1.0')
581
+ .argument('<username>', 'user to login')
582
+ .argument('[password]', 'password for user, if required', 'no password given')
583
+ .action((username, password) => {
584
+ console.log('username:', username);
585
+ console.log('password:', password);
586
+ });
587
+ ```
588
+
589
+ The last argument of a command can be variadic, and _only_ the last argument. To make an argument variadic, simply
590
+ append `...` to the argument name.
591
+
592
+ A variadic argument is passed to the action handler as an array.
593
+
594
+ ```js
595
+ program
596
+ .version('0.1.0')
597
+ .command('rmdir')
598
+ .argument('<dirs...>')
599
+ .action(function (dirs) {
600
+ dirs.forEach((dir) => {
601
+ console.log('rmdir %s', dir);
602
+ });
603
+ });
604
+ ```
605
+
606
+ There is a convenience method to add multiple arguments at once, but without descriptions:
607
+
608
+ ```js
609
+ program
610
+ .arguments('<username> <password>');
611
+ ```
612
+
613
+ #### More configuration
614
+
615
+ There are some additional features available by constructing an `Argument` explicitly for less common cases.
616
+
617
+ Example file: [arguments-extra.js](./examples/arguments-extra.js)
618
+
619
+ ```js
620
+ program
621
+ .addArgument(new commander.Argument('<drink-size>', 'drink cup size').choices(['small', 'medium', 'large']))
622
+ .addArgument(new commander.Argument('[timeout]', 'timeout in seconds').default(60, 'one minute'))
623
+ ```
624
+
625
+ #### Custom argument processing
626
+
627
+ You may specify a function to do custom processing of command-arguments (like for option-arguments).
628
+ The callback function receives two parameters, the user specified command-argument and the previous value for the argument.
629
+ It returns the new value for the argument.
630
+
631
+ The processed argument values are passed to the action handler, and saved as `.processedArgs`.
632
+
633
+ You can optionally specify the default/starting value for the argument after the function parameter.
634
+
635
+ Example file: [arguments-custom-processing.js](./examples/arguments-custom-processing.js)
636
+
637
+ ```js
638
+ program
639
+ .command('add')
640
+ .argument('<first>', 'integer argument', myParseInt)
641
+ .argument('[second]', 'integer argument', myParseInt, 1000)
642
+ .action((first, second) => {
643
+ console.log(`${first} + ${second} = ${first + second}`);
644
+ })
645
+ ;
646
+ ```
647
+
648
+ ### Action handler
649
+
650
+ The action handler gets passed a parameter for each command-argument you declared, and two additional parameters
651
+ which are the parsed options and the command object itself.
652
+
653
+ Example file: [thank.js](./examples/thank.js)
654
+
655
+ ```js
656
+ program
657
+ .argument('<name>')
658
+ .option('-t, --title <honorific>', 'title to use before name')
659
+ .option('-d, --debug', 'display some debugging')
660
+ .action((name, options, command) => {
661
+ if (options.debug) {
662
+ console.error('Called %s with options %o', command.name(), options);
663
+ }
664
+ const title = options.title ? `${options.title} ` : '';
665
+ console.log(`Thank-you ${title}${name}`);
666
+ });
667
+ ```
668
+
669
+ If you prefer, you can work with the command directly and skip declaring the parameters for the action handler. If you use a function expression (but not an arrow function), the `this` keyword is set to the running command.
670
+
671
+ Example file: [action-this.js](./examples/action-this.js)
672
+
673
+ ```js
674
+ program
675
+ .command('serve')
676
+ .argument('<script>')
677
+ .option('-p, --port <number>', 'port number', 80)
678
+ .action(function() {
679
+ console.error('Run script %s on port %s', this.args[0], this.opts().port);
680
+ });
681
+ ```
682
+
683
+ You may supply an `async` action handler, in which case you call `.parseAsync()` rather than `.parse()`.
684
+
685
+ ```js
686
+ async function run() { /* code goes here */ }
687
+
688
+ async function main() {
689
+ program
690
+ .command('run')
691
+ .action(run);
692
+ await program.parseAsync(process.argv);
693
+ }
694
+ ```
695
+
696
+ A command's options and arguments on the command line are validated when the command is used. Any unknown options, missing arguments, or excess arguments will be reported as an error.
697
+
698
+ You can suppress the unknown option check with `.allowUnknownOption()`. You can suppress the excess arguments check with `.allowExcessArguments()`.
699
+
700
+ ### Stand-alone executable (sub)commands
701
+
702
+ When `.command()` is invoked with a description argument, this tells Commander that you're going to use stand-alone executables for subcommands.
703
+ Commander will search the files in the directory of the entry script for a file with the name combination `command-subcommand` (like `pm-install` or `pm-search` in the example below). The search includes trying common file extensions, like `.js`.
704
+ You may specify a custom name (and path) with the `executableFile` configuration option.
705
+ You may specify a custom search directory for subcommands with `.executableDir()`.
706
+
707
+ You handle the options for an executable (sub)command in the executable, and don't declare them at the top-level.
708
+
709
+ Example file: [pm](./examples/pm)
710
+
711
+ ```js
712
+ program
713
+ .name('pm')
714
+ .version('0.1.0')
715
+ .command('install [package-names...]', 'install one or more packages')
716
+ .command('search [query]', 'search with optional query')
717
+ .command('update', 'update installed packages', { executableFile: 'myUpdateSubCommand' })
718
+ .command('list', 'list packages installed', { isDefault: true });
719
+
720
+ program.parse(process.argv);
721
+ ```
722
+
723
+ If the program is designed to be installed globally, make sure the executables have proper modes, like `755`.
724
+
725
+ ### Life cycle hooks
726
+
727
+ You can add callback hooks to a command for life cycle events.
728
+
729
+ Example file: [hook.js](./examples/hook.js)
730
+
731
+ ```js
732
+ program
733
+ .option('-t, --trace', 'display trace statements for commands')
734
+ .hook('preAction', (thisCommand, actionCommand) => {
735
+ if (thisCommand.opts().trace) {
736
+ console.log(`About to call action handler for subcommand: ${actionCommand.name()}`);
737
+ console.log('arguments: %O', actionCommand.args);
738
+ console.log('options: %o', actionCommand.opts());
739
+ }
740
+ });
741
+ ```
742
+
743
+ The callback hook can be `async`, in which case you call `.parseAsync()` rather than `.parse()`. You can add multiple hooks per event.
744
+
745
+ The supported events are:
746
+
747
+ | event name | when hook called | callback parameters |
748
+ | :-- | :-- | :-- |
749
+ | `preAction`, `postAction` | before/after action handler for this command and its nested subcommands | `(thisCommand, actionCommand)` |
750
+ | `preSubcommand` | before parsing direct subcommand | `(thisCommand, subcommand)` |
751
+
752
+ For an overview of the life cycle events, see [parsing life cycle and hooks](./docs/parsing-and-hooks.md).
753
+
754
+ ## Automated help
755
+
756
+ The help information is auto-generated based on the information commander already knows about your program. The default
757
+ help option is `-h,--help`.
758
+
759
+ Example file: [pizza](./examples/pizza)
760
+
761
+ ```console
762
+ $ node ./examples/pizza --help
763
+ Usage: pizza [options]
764
+
765
+ An application for pizza ordering
766
+
767
+ Options:
768
+ -p, --peppers Add peppers
769
+ -c, --cheese <type> Add the specified type of cheese (default: "marble")
770
+ -C, --no-cheese You do not want any cheese
771
+ -h, --help display help for command
772
+ ```
773
+
774
+ A `help` command is added by default if your command has subcommands. It can be used alone, or with a subcommand name to show
775
+ further help for the subcommand. These are effectively the same if the `shell` program has implicit help:
776
+
777
+ ```sh
778
+ shell help
779
+ shell --help
780
+
781
+ shell help spawn
782
+ shell spawn --help
783
+ ```
784
+
785
+ Long descriptions are wrapped to fit the available width. (However, a description that includes a line-break followed by whitespace is assumed to be pre-formatted and not wrapped.)
786
+
787
+ ### Custom help
788
+
789
+ You can add extra text to be displayed along with the built-in help.
790
+
791
+ Example file: [custom-help](./examples/custom-help)
792
+
793
+ ```js
794
+ program
795
+ .option('-f, --foo', 'enable some foo');
796
+
797
+ program.addHelpText('after', `
798
+
799
+ Example call:
800
+ $ custom-help --help`);
801
+ ```
802
+
803
+ Yields the following help output:
804
+
805
+ ```Text
806
+ Usage: custom-help [options]
807
+
808
+ Options:
809
+ -f, --foo enable some foo
810
+ -h, --help display help for command
811
+
812
+ Example call:
813
+ $ custom-help --help
814
+ ```
815
+
816
+ The positions in order displayed are:
817
+
818
+ - `beforeAll`: add to the program for a global banner or header
819
+ - `before`: display extra information before built-in help
820
+ - `after`: display extra information after built-in help
821
+ - `afterAll`: add to the program for a global footer (epilog)
822
+
823
+ The positions "beforeAll" and "afterAll" apply to the command and all its subcommands.
824
+
825
+ The second parameter can be a string, or a function returning a string. The function is passed a context object for your convenience. The properties are:
826
+
827
+ - `error`: a boolean for whether the help is being displayed due to a usage error
828
+ - `command`: the `Command` which is displaying the help
829
+
830
+ ### Display help after errors
831
+
832
+ The default behaviour for usage errors is to just display a short error message.
833
+ You can change the behaviour to show the full help or a custom help message after an error.
834
+
835
+ ```js
836
+ program.showHelpAfterError();
837
+ // or
838
+ program.showHelpAfterError('(add --help for additional information)');
839
+ ```
840
+
841
+ ```console
842
+ $ pizza --unknown
843
+ error: unknown option '--unknown'
844
+ (add --help for additional information)
845
+ ```
846
+
847
+ The default behaviour is to suggest correct spelling after an error for an unknown command or option. You
848
+ can disable this.
849
+
850
+ ```js
851
+ program.showSuggestionAfterError(false);
852
+ ```
853
+
854
+ ```console
855
+ $ pizza --hepl
856
+ error: unknown option '--hepl'
857
+ (Did you mean --help?)
858
+ ```
859
+
860
+ ### Display help from code
861
+
862
+ `.help()`: display help information and exit immediately. You can optionally pass `{ error: true }` to display on stderr and exit with an error status.
863
+
864
+ `.outputHelp()`: output help information without exiting. You can optionally pass `{ error: true }` to display on stderr.
865
+
866
+ `.helpInformation()`: get the built-in command help information as a string for processing or displaying yourself.
867
+
868
+ ### .name
869
+
870
+ The command name appears in the help, and is also used for locating stand-alone executable subcommands.
871
+
872
+ You may specify the program name using `.name()` or in the `Command` constructor. For the program, Commander will
873
+ fall back to using the script name from the full arguments passed into `.parse()`. However, the script name varies
874
+ depending on how your program is launched, so you may wish to specify it explicitly.
875
+
876
+ ```js
877
+ program.name('pizza');
878
+ const pm = new Command('pm');
879
+ ```
880
+
881
+ Subcommands get a name when specified using `.command()`. If you create the subcommand yourself to use with `.addCommand()`,
882
+ then set the name using `.name()` or in the `Command` constructor.
883
+
884
+ ### .usage
885
+
886
+ This allows you to customise the usage description in the first line of the help. Given:
887
+
888
+ ```js
889
+ program
890
+ .name("my-command")
891
+ .usage("[global options] command")
892
+ ```
893
+
894
+ The help will start with:
895
+
896
+ ```Text
897
+ Usage: my-command [global options] command
898
+ ```
899
+
900
+ ### .description and .summary
901
+
902
+ The description appears in the help for the command. You can optionally supply a shorter
903
+ summary to use when listed as a subcommand of the program.
904
+
905
+ ```js
906
+ program
907
+ .command("duplicate")
908
+ .summary("make a copy")
909
+ .description(`Make a copy of the current project.
910
+ This may require additional disk space.
911
+ `);
912
+ ```
913
+
914
+ ### .helpOption(flags, description)
915
+
916
+ By default, every command has a help option. You may change the default help flags and description. Pass `false` to disable the built-in help option.
917
+
918
+ ```js
919
+ program
920
+ .helpOption('-e, --HELP', 'read more information');
921
+ ```
922
+
923
+ Alternatively, use `.addHelpOption()` to add an option you construct yourself.
924
+
925
+ ### .helpCommand()
926
+
927
+ A help command is added by default if your command has subcommands. You can explicitly turn the implicit help command on or off with `.helpCommand(true)` and `.helpCommand(false)`.
928
+
929
+ You can both turn on and customise the help command by supplying the name and description:
930
+
931
+ ```js
932
+ program.helpCommand('assist [command]', 'show assistance');
933
+ ```
934
+
935
+ Alternatively, use `.addHelpCommand()` to add a command you construct yourself.
936
+
937
+ ### Help Groups
938
+
939
+ The help by default lists options under the the heading `Options:` and commands under `Commands:`. You can create your own groups
940
+ with different headings.
941
+
942
+ - The high-level way is to set the desired group heading while adding the options and commands, using `.optionsGroup()` and `.commandsGroup()`.
943
+ - The low-level way is using `.helpGroup()` on an individual `Option` or `Command`.
944
+
945
+ Example file: [help-groups.js](./examples/help-groups.js)
946
+
947
+ ### More configuration
948
+
949
+ The built-in help is formatted using the `Help` class.
950
+ You can configure the help by modifying data properties and methods using `.configureHelp()`, or by subclassing `Help` using `.createHelp()` .
951
+
952
+ Simple properties include `sortSubcommands`, `sortOptions`, and `showGlobalOptions`. You can add color using the style methods like `.styleTitle()`.
953
+
954
+ For more detail and examples of changing the displayed text, color, and layout, see: [Help in Depth](./docs/help-in-depth.md).
955
+
956
+ ## Custom event listeners
957
+
958
+ You can execute custom actions by listening to `command` and `option` events.
959
+
960
+ ```js
961
+ program.on('option:verbose', function () {
962
+ process.env.VERBOSE = this.opts().verbose;
963
+ });
964
+ ```
965
+
966
+ ## Bits and pieces
967
+
968
+ ### .parse() and .parseAsync()
969
+
970
+ Call with no parameters to parse `process.argv`. Detects Electron and special node options like `node --eval`. Easy mode!
971
+
972
+ Or, call with an array of strings to parse, and optionally where the user arguments start by specifying where the arguments are `from`:
973
+
974
+ - `'node'`: default, `argv[0]` is the application and `argv[1]` is the script being run, with user arguments after that
975
+ - `'electron'`: `argv[0]` is the application and `argv[1]` varies depending on whether the electron application is packaged
976
+ - `'user'`: just user arguments
977
+
978
+ For example:
979
+
980
+ ```js
981
+ program.parse(); // parse process.argv and auto-detect electron and special node flags
982
+ program.parse(process.argv); // assume argv[0] is app and argv[1] is script
983
+ program.parse(['--port', '80'], { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
984
+ ```
985
+
986
+ Use `.parseAsync()` instead of `.parse()` if any of your action handlers are async.
987
+
988
+ ### Parsing Configuration
989
+
990
+ If the default parsing does not suit your needs, there are some behaviours to support other usage patterns.
991
+
992
+ By default, program options are recognised before and after subcommands. To only look for program options before subcommands, use `.enablePositionalOptions()`. This lets you use
993
+ an option for a different purpose in subcommands.
994
+
995
+ Example file: [positional-options.js](./examples/positional-options.js)
996
+
997
+ With positional options, the `-b` is a program option in the first line and a subcommand option in the second line:
998
+
999
+ ```sh
1000
+ program -b subcommand
1001
+ program subcommand -b
1002
+ ```
1003
+
1004
+ By default, options are recognised before and after command-arguments. To only process options that come
1005
+ before the command-arguments, use `.passThroughOptions()`. This lets you pass the arguments and following options through to another program
1006
+ without needing to use `--` to end the option processing.
1007
+ To use pass through options in a subcommand, the program needs to enable positional options.
1008
+
1009
+ Example file: [pass-through-options.js](./examples/pass-through-options.js)
1010
+
1011
+ With pass through options, the `--port=80` is a program option in the first line and passed through as a command-argument in the second line:
1012
+
1013
+ ```sh
1014
+ program --port=80 arg
1015
+ program arg --port=80
1016
+ ```
1017
+
1018
+ By default, the option processing shows an error for an unknown option. To have an unknown option treated as an ordinary command-argument and continue looking for options, use `.allowUnknownOption()`. This lets you mix known and unknown options.
1019
+
1020
+ By default, the argument processing displays an error for more command-arguments than expected.
1021
+ To suppress the error for excess arguments, use `.allowExcessArguments()`.
1022
+
1023
+ ### Legacy options as properties
1024
+
1025
+ Before Commander 7, the option values were stored as properties on the command.
1026
+ This was convenient to code, but the downside was possible clashes with
1027
+ existing properties of `Command`.
1028
+
1029
+ You can revert to the old behaviour to run unmodified legacy code by using `.storeOptionsAsProperties()`.
1030
+
1031
+ ```js
1032
+ program
1033
+ .storeOptionsAsProperties()
1034
+ .option('-d, --debug')
1035
+ .action((commandAndOptions) => {
1036
+ if (commandAndOptions.debug) {
1037
+ console.error(`Called ${commandAndOptions.name()}`);
1038
+ }
1039
+ });
1040
+ ```
1041
+
1042
+ ### TypeScript
1043
+
1044
+ **extra-typings:** There is an optional project to infer extra type information from the option and argument definitions.
1045
+ This adds strong typing to the options returned by `.opts()` and the parameters to `.action()`.
1046
+ For more, see the repo: [commander-js/extra-typings](https://github.com/commander-js/extra-typings).
1047
+
1048
+ ```ts
1049
+ import { Command } from '@commander-js/extra-typings';
1050
+ ```
1051
+
1052
+ **ts-node:** If you use `ts-node` and stand-alone executable subcommands written as `.ts` files, you need to call your program through node to get the subcommands called correctly, e.g.:
1053
+
1054
+ ```sh
1055
+ node -r ts-node/register pm.ts
1056
+ ```
1057
+
1058
+ ### createCommand()
1059
+
1060
+ This factory function creates a new command. It is exported and may be used instead of using `new`, like:
1061
+
1062
+ ```js
1063
+ const { createCommand } = require('commander');
1064
+ const program = createCommand();
1065
+ ```
1066
+
1067
+ `createCommand()` is also a method of the `Command` object, and creates a new command rather than a subcommand. This gets used internally
1068
+ when creating subcommands using `.command()`, and you may override it to
1069
+ customise the new subcommand. Example file: [custom-command-class.js](./examples/custom-command-class.js).
1070
+
1071
+ ### Node options such as `--harmony`
1072
+
1073
+ You can enable `--harmony` option in two ways:
1074
+
1075
+ - Use `#! /usr/bin/env node --harmony` in the subcommands scripts. (Note: Windows does not support this pattern.)
1076
+ - Use the `--harmony` option when calling the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning subcommand processes.
1077
+
1078
+ ### Debugging stand-alone executable subcommands
1079
+
1080
+ An executable subcommand is launched as a separate child process.
1081
+
1082
+ If you are using the node inspector for [debugging](https://nodejs.org/en/docs/guides/debugging-getting-started/) executable subcommands using `node --inspect` et al.,
1083
+ the inspector port is incremented by 1 for the spawned subcommand.
1084
+
1085
+ If you are using VSCode to debug executable subcommands you need to set the `"autoAttachChildProcesses": true` flag in your `launch.json` configuration.
1086
+
1087
+ ### npm run-script
1088
+
1089
+ By default, when you call your program using `run-script`, `npm` will parse any options on the command-line and they will not reach your program. Use
1090
+ `--` to stop the npm option parsing and pass through all the arguments.
1091
+
1092
+ The synopsis for [`npm run-script`](https://docs.npmjs.com/cli/v9/commands/npm-run-script) explicitly shows the `--` for this reason:
1093
+
1094
+ ```console
1095
+ npm run-script <command> [-- <args>]
1096
+ ```
1097
+
1098
+ ### Display error
1099
+
1100
+ This routine is available to invoke the Commander error handling for your own error conditions. (See also the next section about exit handling.)
1101
+
1102
+ As well as the error message, you can optionally specify the `exitCode` (used with `process.exit()`)
1103
+ and `code` (used with `CommanderError`).
1104
+
1105
+ ```js
1106
+ program.error('Password must be longer than four characters');
1107
+ program.error('Custom processing has failed', { exitCode: 2, code: 'my.custom.error' });
1108
+ ```
1109
+
1110
+ ### Override exit and output handling
1111
+
1112
+ By default, Commander calls `process.exit()` when it detects errors, or after displaying the help or version. You can override
1113
+ this behaviour and optionally supply a callback. The default override throws a `CommanderError`.
1114
+
1115
+ The override callback is passed a `CommanderError` with the properties:
1116
+ - `exitCode`: number
1117
+ - `code`: string
1118
+ - `message`: string
1119
+
1120
+ Commander expects the callback to terminate the normal program flow, and will call `process.exit()` if the callback returns.
1121
+ The normal display of error messages or version or help is not affected by the override, which is called after the display.
1122
+
1123
+ ```js
1124
+ program.exitOverride();
1125
+
1126
+ try {
1127
+ program.parse(process.argv);
1128
+ } catch (err) {
1129
+ // custom processing...
1130
+ }
1131
+ ```
1132
+
1133
+ By default, Commander is configured for a command-line application and writes to stdout and stderr.
1134
+ You can modify this behaviour for custom applications. In addition, you can modify the display of error messages.
1135
+
1136
+ Example file: [configure-output.js](./examples/configure-output.js)
1137
+
1138
+ ```js
1139
+ function errorColor(str) {
1140
+ // Add ANSI escape codes to display text in red.
1141
+ return `\x1b[31m${str}\x1b[0m`;
1142
+ }
1143
+
1144
+ program
1145
+ .configureOutput({
1146
+ // Visibly override write routines as example!
1147
+ writeOut: (str) => process.stdout.write(`[OUT] ${str}`),
1148
+ writeErr: (str) => process.stdout.write(`[ERR] ${str}`),
1149
+ // Highlight errors in color.
1150
+ outputError: (str, write) => write(errorColor(str))
1151
+ });
1152
+ ```
1153
+
1154
+ ### Additional documentation
1155
+
1156
+ There is more information available about:
1157
+
1158
+ - [deprecated](./docs/deprecated.md) features still supported for backwards compatibility
1159
+ - [Help in Depth](./docs/help-in-depth.md) configuring help output
1160
+ - [options taking varying arguments](./docs/options-in-depth.md)
1161
+ - [parsing life cycle and hooks](./docs/parsing-and-hooks.md)
1162
+ - [Release Policy](./docs/release-policy.md)
1163
+
1164
+ ## Support
1165
+
1166
+ The current version of Commander is fully supported on Long Term Support versions of Node.js, and requires at least v20.
1167
+
1168
+ Older major versions of Commander receive security updates for 12 months. For more see: [Release Policy](./docs/release-policy.md).
1169
+
1170
+ The main forum for free and community support is the project [Issues](https://github.com/tj/commander.js/issues) on GitHub.
1171
+
1172
+ ### Commander for enterprise
1173
+
1174
+ Available as part of the Tidelift Subscription
1175
+
1176
+ The maintainers of Commander and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-commander?utm_source=npm-commander&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)