@villedemontreal/caporal 3.1.7

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 (425) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +29 -0
  3. package/dist/src/__tests__/issue-163.spec.d.ts +2 -0
  4. package/dist/src/__tests__/issue-163.spec.d.ts.map +1 -0
  5. package/dist/src/__tests__/issue-163.spec.js +17 -0
  6. package/dist/src/__tests__/issue-163.spec.js.map +1 -0
  7. package/dist/src/argument/__tests__/argument.spec.d.ts +2 -0
  8. package/dist/src/argument/__tests__/argument.spec.d.ts.map +1 -0
  9. package/dist/src/argument/__tests__/argument.spec.js +85 -0
  10. package/dist/src/argument/__tests__/argument.spec.js.map +1 -0
  11. package/dist/src/argument/find.d.ts +8 -0
  12. package/dist/src/argument/find.d.ts.map +1 -0
  13. package/dist/src/argument/find.js +11 -0
  14. package/dist/src/argument/find.js.map +1 -0
  15. package/dist/src/argument/index.d.ts +13 -0
  16. package/dist/src/argument/index.d.ts.map +1 -0
  17. package/dist/src/argument/index.js +27 -0
  18. package/dist/src/argument/index.js.map +1 -0
  19. package/dist/src/argument/synopsis.d.ts +19 -0
  20. package/dist/src/argument/synopsis.d.ts.map +1 -0
  21. package/dist/src/argument/synopsis.js +39 -0
  22. package/dist/src/argument/synopsis.js.map +1 -0
  23. package/dist/src/argument/validate.d.ts +43 -0
  24. package/dist/src/argument/validate.d.ts.map +1 -0
  25. package/dist/src/argument/validate.js +127 -0
  26. package/dist/src/argument/validate.js.map +1 -0
  27. package/dist/src/autocomplete/__fixtures__/prog-autocomplete.d.ts +3 -0
  28. package/dist/src/autocomplete/__fixtures__/prog-autocomplete.d.ts.map +1 -0
  29. package/dist/src/autocomplete/__fixtures__/prog-autocomplete.js +24 -0
  30. package/dist/src/autocomplete/__fixtures__/prog-autocomplete.js.map +1 -0
  31. package/dist/src/autocomplete/__tests__/autocomplete.spec.d.ts +2 -0
  32. package/dist/src/autocomplete/__tests__/autocomplete.spec.d.ts.map +1 -0
  33. package/dist/src/autocomplete/__tests__/autocomplete.spec.js +119 -0
  34. package/dist/src/autocomplete/__tests__/autocomplete.spec.js.map +1 -0
  35. package/dist/src/autocomplete/index.d.ts +20 -0
  36. package/dist/src/autocomplete/index.d.ts.map +1 -0
  37. package/dist/src/autocomplete/index.js +172 -0
  38. package/dist/src/autocomplete/index.js.map +1 -0
  39. package/dist/src/autocomplete/types.d.ts +26 -0
  40. package/dist/src/autocomplete/types.d.ts.map +1 -0
  41. package/dist/src/autocomplete/types.js +3 -0
  42. package/dist/src/autocomplete/types.js.map +1 -0
  43. package/dist/src/command/__fixtures__/example-cmd.d.ts +8 -0
  44. package/dist/src/command/__fixtures__/example-cmd.d.ts.map +1 -0
  45. package/dist/src/command/__fixtures__/example-cmd.js +10 -0
  46. package/dist/src/command/__fixtures__/example-cmd.js.map +1 -0
  47. package/dist/src/command/__tests__/command.spec.d.ts +2 -0
  48. package/dist/src/command/__tests__/command.spec.d.ts.map +1 -0
  49. package/dist/src/command/__tests__/command.spec.js +510 -0
  50. package/dist/src/command/__tests__/command.spec.js.map +1 -0
  51. package/dist/src/command/__tests__/find.spec.d.ts +2 -0
  52. package/dist/src/command/__tests__/find.spec.d.ts.map +1 -0
  53. package/dist/src/command/__tests__/find.spec.js +31 -0
  54. package/dist/src/command/__tests__/find.spec.js.map +1 -0
  55. package/dist/src/command/__tests__/import.spec.d.ts +2 -0
  56. package/dist/src/command/__tests__/import.spec.d.ts.map +1 -0
  57. package/dist/src/command/__tests__/import.spec.js +17 -0
  58. package/dist/src/command/__tests__/import.spec.js.map +1 -0
  59. package/dist/src/command/__tests__/scan.spec.d.ts +2 -0
  60. package/dist/src/command/__tests__/scan.spec.d.ts.map +1 -0
  61. package/dist/src/command/__tests__/scan.spec.js +20 -0
  62. package/dist/src/command/__tests__/scan.spec.js.map +1 -0
  63. package/dist/src/command/find.d.ts +8 -0
  64. package/dist/src/command/find.d.ts.map +1 -0
  65. package/dist/src/command/find.js +47 -0
  66. package/dist/src/command/find.js.map +1 -0
  67. package/dist/src/command/import.d.ts +7 -0
  68. package/dist/src/command/import.d.ts.map +1 -0
  69. package/dist/src/command/import.js +47 -0
  70. package/dist/src/command/import.js.map +1 -0
  71. package/dist/src/command/index.d.ts +211 -0
  72. package/dist/src/command/index.d.ts.map +1 -0
  73. package/dist/src/command/index.js +374 -0
  74. package/dist/src/command/index.js.map +1 -0
  75. package/dist/src/command/scan.d.ts +4 -0
  76. package/dist/src/command/scan.d.ts.map +1 -0
  77. package/dist/src/command/scan.js +31 -0
  78. package/dist/src/command/scan.js.map +1 -0
  79. package/dist/src/command/validate-call.d.ts +8 -0
  80. package/dist/src/command/validate-call.d.ts.map +1 -0
  81. package/dist/src/command/validate-call.js +13 -0
  82. package/dist/src/command/validate-call.js.map +1 -0
  83. package/dist/src/config/index.d.ts +7 -0
  84. package/dist/src/config/index.d.ts.map +1 -0
  85. package/dist/src/config/index.js +24 -0
  86. package/dist/src/config/index.js.map +1 -0
  87. package/dist/src/error/__tests__/fatal.spec.d.ts +2 -0
  88. package/dist/src/error/__tests__/fatal.spec.d.ts.map +1 -0
  89. package/dist/src/error/__tests__/fatal.spec.js +34 -0
  90. package/dist/src/error/__tests__/fatal.spec.js.map +1 -0
  91. package/dist/src/error/action.d.ts +9 -0
  92. package/dist/src/error/action.d.ts.map +1 -0
  93. package/dist/src/error/action.js +16 -0
  94. package/dist/src/error/action.js.map +1 -0
  95. package/dist/src/error/base.d.ts +11 -0
  96. package/dist/src/error/base.d.ts.map +1 -0
  97. package/dist/src/error/base.js +18 -0
  98. package/dist/src/error/base.js.map +1 -0
  99. package/dist/src/error/fatal.d.ts +10 -0
  100. package/dist/src/error/fatal.d.ts.map +1 -0
  101. package/dist/src/error/fatal.js +27 -0
  102. package/dist/src/error/fatal.js.map +1 -0
  103. package/dist/src/error/index.d.ts +18 -0
  104. package/dist/src/error/index.d.ts.map +1 -0
  105. package/dist/src/error/index.js +34 -0
  106. package/dist/src/error/index.js.map +1 -0
  107. package/dist/src/error/invalid-validator.d.ts +10 -0
  108. package/dist/src/error/invalid-validator.d.ts.map +1 -0
  109. package/dist/src/error/invalid-validator.js +15 -0
  110. package/dist/src/error/invalid-validator.js.map +1 -0
  111. package/dist/src/error/missing-argument.d.ts +11 -0
  112. package/dist/src/error/missing-argument.d.ts.map +1 -0
  113. package/dist/src/error/missing-argument.js +20 -0
  114. package/dist/src/error/missing-argument.js.map +1 -0
  115. package/dist/src/error/missing-flag.d.ts +11 -0
  116. package/dist/src/error/missing-flag.d.ts.map +1 -0
  117. package/dist/src/error/missing-flag.js +20 -0
  118. package/dist/src/error/missing-flag.js.map +1 -0
  119. package/dist/src/error/multi-validation.d.ts +10 -0
  120. package/dist/src/error/multi-validation.d.ts.map +1 -0
  121. package/dist/src/error/multi-validation.js +26 -0
  122. package/dist/src/error/multi-validation.js.map +1 -0
  123. package/dist/src/error/no-action.d.ts +10 -0
  124. package/dist/src/error/no-action.d.ts.map +1 -0
  125. package/dist/src/error/no-action.js +22 -0
  126. package/dist/src/error/no-action.js.map +1 -0
  127. package/dist/src/error/option-synopsis-syntax.d.ts +9 -0
  128. package/dist/src/error/option-synopsis-syntax.d.ts.map +1 -0
  129. package/dist/src/error/option-synopsis-syntax.js +15 -0
  130. package/dist/src/error/option-synopsis-syntax.js.map +1 -0
  131. package/dist/src/error/too-many-arguments.d.ts +11 -0
  132. package/dist/src/error/too-many-arguments.d.ts.map +1 -0
  133. package/dist/src/error/too-many-arguments.js +25 -0
  134. package/dist/src/error/too-many-arguments.js.map +1 -0
  135. package/dist/src/error/unknown-command.d.ts +13 -0
  136. package/dist/src/error/unknown-command.d.ts.map +1 -0
  137. package/dist/src/error/unknown-command.js +44 -0
  138. package/dist/src/error/unknown-command.js.map +1 -0
  139. package/dist/src/error/unknown-option.d.ts +13 -0
  140. package/dist/src/error/unknown-option.d.ts.map +1 -0
  141. package/dist/src/error/unknown-option.js +40 -0
  142. package/dist/src/error/unknown-option.js.map +1 -0
  143. package/dist/src/error/validation.d.ts +17 -0
  144. package/dist/src/error/validation.d.ts.map +1 -0
  145. package/dist/src/error/validation.js +49 -0
  146. package/dist/src/error/validation.js.map +1 -0
  147. package/dist/src/help/__tests__/help.spec.d.ts +2 -0
  148. package/dist/src/help/__tests__/help.spec.d.ts.map +1 -0
  149. package/dist/src/help/__tests__/help.spec.js +130 -0
  150. package/dist/src/help/__tests__/help.spec.js.map +1 -0
  151. package/dist/src/help/__tests__/utils.spec.d.ts +2 -0
  152. package/dist/src/help/__tests__/utils.spec.d.ts.map +1 -0
  153. package/dist/src/help/__tests__/utils.spec.js +16 -0
  154. package/dist/src/help/__tests__/utils.spec.js.map +1 -0
  155. package/dist/src/help/index.d.ts +47 -0
  156. package/dist/src/help/index.d.ts.map +1 -0
  157. package/dist/src/help/index.js +131 -0
  158. package/dist/src/help/index.js.map +1 -0
  159. package/dist/src/help/templates/command.d.ts +7 -0
  160. package/dist/src/help/templates/command.d.ts.map +1 -0
  161. package/dist/src/help/templates/command.js +23 -0
  162. package/dist/src/help/templates/command.js.map +1 -0
  163. package/dist/src/help/templates/custom.d.ts +7 -0
  164. package/dist/src/help/templates/custom.d.ts.map +1 -0
  165. package/dist/src/help/templates/custom.js +24 -0
  166. package/dist/src/help/templates/custom.js.map +1 -0
  167. package/dist/src/help/templates/header.d.ts +7 -0
  168. package/dist/src/help/templates/header.d.ts.map +1 -0
  169. package/dist/src/help/templates/header.js +16 -0
  170. package/dist/src/help/templates/header.js.map +1 -0
  171. package/dist/src/help/templates/index.d.ts +10 -0
  172. package/dist/src/help/templates/index.d.ts.map +1 -0
  173. package/dist/src/help/templates/index.js +26 -0
  174. package/dist/src/help/templates/index.js.map +1 -0
  175. package/dist/src/help/templates/program.d.ts +7 -0
  176. package/dist/src/help/templates/program.d.ts.map +1 -0
  177. package/dist/src/help/templates/program.js +18 -0
  178. package/dist/src/help/templates/program.js.map +1 -0
  179. package/dist/src/help/templates/usage.d.ts +7 -0
  180. package/dist/src/help/templates/usage.d.ts.map +1 -0
  181. package/dist/src/help/templates/usage.js +19 -0
  182. package/dist/src/help/templates/usage.js.map +1 -0
  183. package/dist/src/help/types.d.ts +53 -0
  184. package/dist/src/help/types.d.ts.map +1 -0
  185. package/dist/src/help/types.js +3 -0
  186. package/dist/src/help/types.js.map +1 -0
  187. package/dist/src/help/utils.d.ts +9 -0
  188. package/dist/src/help/utils.d.ts.map +1 -0
  189. package/dist/src/help/utils.js +92 -0
  190. package/dist/src/help/utils.js.map +1 -0
  191. package/dist/src/index.d.ts +90 -0
  192. package/dist/src/index.d.ts.map +1 -0
  193. package/dist/src/index.js +111 -0
  194. package/dist/src/index.js.map +1 -0
  195. package/dist/src/logger/__tests__/logger.spec.d.ts +2 -0
  196. package/dist/src/logger/__tests__/logger.spec.d.ts.map +1 -0
  197. package/dist/src/logger/__tests__/logger.spec.js +56 -0
  198. package/dist/src/logger/__tests__/logger.spec.js.map +1 -0
  199. package/dist/src/logger/index.d.ts +6 -0
  200. package/dist/src/logger/index.d.ts.map +1 -0
  201. package/dist/src/logger/index.js +128 -0
  202. package/dist/src/logger/index.js.map +1 -0
  203. package/dist/src/option/__tests__/global.spec.d.ts +2 -0
  204. package/dist/src/option/__tests__/global.spec.d.ts.map +1 -0
  205. package/dist/src/option/__tests__/global.spec.js +121 -0
  206. package/dist/src/option/__tests__/global.spec.js.map +1 -0
  207. package/dist/src/option/__tests__/option.spec.d.ts +2 -0
  208. package/dist/src/option/__tests__/option.spec.d.ts.map +1 -0
  209. package/dist/src/option/__tests__/option.spec.js +111 -0
  210. package/dist/src/option/__tests__/option.spec.js.map +1 -0
  211. package/dist/src/option/find.d.ts +14 -0
  212. package/dist/src/option/find.d.ts.map +1 -0
  213. package/dist/src/option/find.js +17 -0
  214. package/dist/src/option/find.js.map +1 -0
  215. package/dist/src/option/index.d.ts +65 -0
  216. package/dist/src/option/index.d.ts.map +1 -0
  217. package/dist/src/option/index.js +230 -0
  218. package/dist/src/option/index.js.map +1 -0
  219. package/dist/src/option/mapping.d.ts +7 -0
  220. package/dist/src/option/mapping.d.ts.map +1 -0
  221. package/dist/src/option/mapping.js +21 -0
  222. package/dist/src/option/mapping.js.map +1 -0
  223. package/dist/src/option/utils.d.ts +35 -0
  224. package/dist/src/option/utils.d.ts.map +1 -0
  225. package/dist/src/option/utils.js +139 -0
  226. package/dist/src/option/utils.js.map +1 -0
  227. package/dist/src/option/validate.d.ts +15 -0
  228. package/dist/src/option/validate.d.ts.map +1 -0
  229. package/dist/src/option/validate.js +63 -0
  230. package/dist/src/option/validate.js.map +1 -0
  231. package/dist/src/parser/__tests__/parser.spec.d.ts +2 -0
  232. package/dist/src/parser/__tests__/parser.spec.d.ts.map +1 -0
  233. package/dist/src/parser/__tests__/parser.spec.js +343 -0
  234. package/dist/src/parser/__tests__/parser.spec.js.map +1 -0
  235. package/dist/src/parser/index.d.ts +17 -0
  236. package/dist/src/parser/index.d.ts.map +1 -0
  237. package/dist/src/parser/index.js +299 -0
  238. package/dist/src/parser/index.js.map +1 -0
  239. package/dist/src/program/__tests__/program.spec.d.ts +2 -0
  240. package/dist/src/program/__tests__/program.spec.d.ts.map +1 -0
  241. package/dist/src/program/__tests__/program.spec.js +261 -0
  242. package/dist/src/program/__tests__/program.spec.js.map +1 -0
  243. package/dist/src/program/index.d.ts +349 -0
  244. package/dist/src/program/index.d.ts.map +1 -0
  245. package/dist/src/program/index.js +584 -0
  246. package/dist/src/program/index.js.map +1 -0
  247. package/dist/src/types.d.ts +396 -0
  248. package/dist/src/types.d.ts.map +1 -0
  249. package/dist/src/types.js +51 -0
  250. package/dist/src/types.js.map +1 -0
  251. package/dist/src/utils/__tests__/fs.spec.d.ts +2 -0
  252. package/dist/src/utils/__tests__/fs.spec.d.ts.map +1 -0
  253. package/dist/src/utils/__tests__/fs.spec.js +14 -0
  254. package/dist/src/utils/__tests__/fs.spec.js.map +1 -0
  255. package/dist/src/utils/__tests__/levenshtein.spec.d.ts +2 -0
  256. package/dist/src/utils/__tests__/levenshtein.spec.d.ts.map +1 -0
  257. package/dist/src/utils/__tests__/levenshtein.spec.js +18 -0
  258. package/dist/src/utils/__tests__/levenshtein.spec.js.map +1 -0
  259. package/dist/src/utils/__tests__/suggest.spec.d.ts +2 -0
  260. package/dist/src/utils/__tests__/suggest.spec.d.ts.map +1 -0
  261. package/dist/src/utils/__tests__/suggest.spec.js +31 -0
  262. package/dist/src/utils/__tests__/suggest.spec.js.map +1 -0
  263. package/dist/src/utils/colorize.d.ts +2 -0
  264. package/dist/src/utils/colorize.d.ts.map +1 -0
  265. package/dist/src/utils/colorize.js +27 -0
  266. package/dist/src/utils/colorize.js.map +1 -0
  267. package/dist/src/utils/fs.d.ts +2 -0
  268. package/dist/src/utils/fs.d.ts.map +1 -0
  269. package/dist/src/utils/fs.js +19 -0
  270. package/dist/src/utils/fs.js.map +1 -0
  271. package/dist/src/utils/levenshtein.d.ts +6 -0
  272. package/dist/src/utils/levenshtein.d.ts.map +1 -0
  273. package/dist/src/utils/levenshtein.js +32 -0
  274. package/dist/src/utils/levenshtein.js.map +1 -0
  275. package/dist/src/utils/suggest.d.ts +15 -0
  276. package/dist/src/utils/suggest.d.ts.map +1 -0
  277. package/dist/src/utils/suggest.js +49 -0
  278. package/dist/src/utils/suggest.js.map +1 -0
  279. package/dist/src/utils/version.d.ts +2 -0
  280. package/dist/src/utils/version.d.ts.map +1 -0
  281. package/dist/src/utils/version.js +21 -0
  282. package/dist/src/utils/version.js.map +1 -0
  283. package/dist/src/utils/web/autocomplete.d.ts +12 -0
  284. package/dist/src/utils/web/autocomplete.d.ts.map +1 -0
  285. package/dist/src/utils/web/autocomplete.js +12 -0
  286. package/dist/src/utils/web/autocomplete.js.map +1 -0
  287. package/dist/src/utils/web/process.d.ts +15 -0
  288. package/dist/src/utils/web/process.d.ts.map +1 -0
  289. package/dist/src/utils/web/process.js +29 -0
  290. package/dist/src/utils/web/process.js.map +1 -0
  291. package/dist/src/validator/__tests__/array.spec.d.ts +2 -0
  292. package/dist/src/validator/__tests__/array.spec.d.ts.map +1 -0
  293. package/dist/src/validator/__tests__/array.spec.js +34 -0
  294. package/dist/src/validator/__tests__/array.spec.js.map +1 -0
  295. package/dist/src/validator/__tests__/caporal.spec.d.ts +2 -0
  296. package/dist/src/validator/__tests__/caporal.spec.d.ts.map +1 -0
  297. package/dist/src/validator/__tests__/caporal.spec.js +86 -0
  298. package/dist/src/validator/__tests__/caporal.spec.js.map +1 -0
  299. package/dist/src/validator/__tests__/function.spec.d.ts +2 -0
  300. package/dist/src/validator/__tests__/function.spec.d.ts.map +1 -0
  301. package/dist/src/validator/__tests__/function.spec.js +42 -0
  302. package/dist/src/validator/__tests__/function.spec.js.map +1 -0
  303. package/dist/src/validator/__tests__/regexp.spec.d.ts +2 -0
  304. package/dist/src/validator/__tests__/regexp.spec.d.ts.map +1 -0
  305. package/dist/src/validator/__tests__/regexp.spec.js +34 -0
  306. package/dist/src/validator/__tests__/regexp.spec.js.map +1 -0
  307. package/dist/src/validator/__tests__/utils.spec.d.ts +2 -0
  308. package/dist/src/validator/__tests__/utils.spec.d.ts.map +1 -0
  309. package/dist/src/validator/__tests__/utils.spec.js +66 -0
  310. package/dist/src/validator/__tests__/utils.spec.js.map +1 -0
  311. package/dist/src/validator/__tests__/validate.spec.d.ts +2 -0
  312. package/dist/src/validator/__tests__/validate.spec.d.ts.map +1 -0
  313. package/dist/src/validator/__tests__/validate.spec.js +25 -0
  314. package/dist/src/validator/__tests__/validate.spec.js.map +1 -0
  315. package/dist/src/validator/array.d.ts +14 -0
  316. package/dist/src/validator/array.d.ts.map +1 -0
  317. package/dist/src/validator/array.js +29 -0
  318. package/dist/src/validator/array.js.map +1 -0
  319. package/dist/src/validator/caporal.d.ts +25 -0
  320. package/dist/src/validator/caporal.d.ts.map +1 -0
  321. package/dist/src/validator/caporal.js +89 -0
  322. package/dist/src/validator/caporal.js.map +1 -0
  323. package/dist/src/validator/function.d.ts +7 -0
  324. package/dist/src/validator/function.d.ts.map +1 -0
  325. package/dist/src/validator/function.js +27 -0
  326. package/dist/src/validator/function.js.map +1 -0
  327. package/dist/src/validator/regexp.d.ts +14 -0
  328. package/dist/src/validator/regexp.d.ts.map +1 -0
  329. package/dist/src/validator/regexp.js +31 -0
  330. package/dist/src/validator/regexp.js.map +1 -0
  331. package/dist/src/validator/utils.d.ts +14 -0
  332. package/dist/src/validator/utils.d.ts.map +1 -0
  333. package/dist/src/validator/utils.js +81 -0
  334. package/dist/src/validator/utils.js.map +1 -0
  335. package/dist/src/validator/validate.d.ts +7 -0
  336. package/dist/src/validator/validate.d.ts.map +1 -0
  337. package/dist/src/validator/validate.js +29 -0
  338. package/dist/src/validator/validate.js.map +1 -0
  339. package/dist/tsconfig.tsbuildinfo +1 -0
  340. package/package.json +75 -0
  341. package/src/__tests__/issue-163.spec.ts +18 -0
  342. package/src/argument/__tests__/argument.spec.ts +84 -0
  343. package/src/argument/find.ts +11 -0
  344. package/src/argument/index.ts +35 -0
  345. package/src/argument/synopsis.ts +41 -0
  346. package/src/argument/validate.ts +176 -0
  347. package/src/autocomplete/__fixtures__/prog-autocomplete.ts +24 -0
  348. package/src/autocomplete/__tests__/autocomplete.spec.ts +129 -0
  349. package/src/autocomplete/index.ts +225 -0
  350. package/src/autocomplete/types.ts +29 -0
  351. package/src/command/__fixtures__/example-cmd.ts +14 -0
  352. package/src/command/__tests__/command.spec.ts +621 -0
  353. package/src/command/__tests__/find.spec.ts +32 -0
  354. package/src/command/__tests__/import.spec.ts +14 -0
  355. package/src/command/__tests__/scan.spec.ts +16 -0
  356. package/src/command/find.ts +57 -0
  357. package/src/command/import.ts +13 -0
  358. package/src/command/index.ts +458 -0
  359. package/src/command/scan.ts +30 -0
  360. package/src/command/validate-call.ts +19 -0
  361. package/src/config/index.ts +26 -0
  362. package/src/error/__tests__/fatal.spec.ts +38 -0
  363. package/src/error/action.ts +13 -0
  364. package/src/error/base.ts +20 -0
  365. package/src/error/fatal.ts +25 -0
  366. package/src/error/index.ts +17 -0
  367. package/src/error/invalid-validator.ts +12 -0
  368. package/src/error/missing-argument.ts +16 -0
  369. package/src/error/missing-flag.ts +16 -0
  370. package/src/error/multi-validation.ts +22 -0
  371. package/src/error/no-action.ts +19 -0
  372. package/src/error/option-synopsis-syntax.ts +12 -0
  373. package/src/error/too-many-arguments.ts +28 -0
  374. package/src/error/unknown-command.ts +41 -0
  375. package/src/error/unknown-option.ts +40 -0
  376. package/src/error/validation.ts +80 -0
  377. package/src/help/__tests__/__snapshots__/help.spec.ts.snap +334 -0
  378. package/src/help/__tests__/help.spec.ts +144 -0
  379. package/src/help/__tests__/utils.spec.ts +14 -0
  380. package/src/help/index.ts +107 -0
  381. package/src/help/templates/command.ts +27 -0
  382. package/src/help/templates/custom.ts +25 -0
  383. package/src/help/templates/header.ts +19 -0
  384. package/src/help/templates/index.ts +9 -0
  385. package/src/help/templates/program.ts +21 -0
  386. package/src/help/templates/usage.ts +24 -0
  387. package/src/help/types.ts +57 -0
  388. package/src/help/utils.ts +109 -0
  389. package/src/index.ts +93 -0
  390. package/src/logger/__tests__/logger.spec.ts +65 -0
  391. package/src/logger/index.ts +97 -0
  392. package/src/option/__tests__/global.spec.ts +141 -0
  393. package/src/option/__tests__/option.spec.ts +115 -0
  394. package/src/option/find.ts +17 -0
  395. package/src/option/index.ts +280 -0
  396. package/src/option/mapping.ts +17 -0
  397. package/src/option/utils.ts +141 -0
  398. package/src/option/validate.ts +80 -0
  399. package/src/parser/__tests__/parser.spec.ts +371 -0
  400. package/src/parser/index.ts +383 -0
  401. package/src/program/__tests__/program.spec.ts +316 -0
  402. package/src/program/index.ts +676 -0
  403. package/src/types.ts +432 -0
  404. package/src/utils/__tests__/fs.spec.ts +14 -0
  405. package/src/utils/__tests__/levenshtein.spec.ts +16 -0
  406. package/src/utils/__tests__/suggest.spec.ts +30 -0
  407. package/src/utils/colorize.ts +21 -0
  408. package/src/utils/fs.ts +13 -0
  409. package/src/utils/levenshtein.ts +28 -0
  410. package/src/utils/suggest.ts +52 -0
  411. package/src/utils/version.ts +14 -0
  412. package/src/utils/web/autocomplete.ts +19 -0
  413. package/src/utils/web/process.ts +24 -0
  414. package/src/validator/__tests__/array.spec.ts +41 -0
  415. package/src/validator/__tests__/caporal.spec.ts +132 -0
  416. package/src/validator/__tests__/function.spec.ts +52 -0
  417. package/src/validator/__tests__/regexp.spec.ts +38 -0
  418. package/src/validator/__tests__/utils.spec.ts +67 -0
  419. package/src/validator/__tests__/validate.spec.ts +24 -0
  420. package/src/validator/array.ts +31 -0
  421. package/src/validator/caporal.ts +104 -0
  422. package/src/validator/function.ts +31 -0
  423. package/src/validator/regexp.ts +34 -0
  424. package/src/validator/utils.ts +84 -0
  425. package/src/validator/validate.ts +38 -0
@@ -0,0 +1,374 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Command = exports.HELP_CMD = exports.PROG_CMD = void 0;
4
+ exports.createCommand = createCommand;
5
+ /**
6
+ * @packageDocumentation
7
+ * @module caporal/command
8
+ */
9
+ const validate_call_1 = require("./validate-call");
10
+ const logger_1 = require("../logger");
11
+ const argument_1 = require("../argument");
12
+ const option_1 = require("../option");
13
+ const autocomplete_1 = require("../autocomplete");
14
+ const mapping_1 = require("../option/mapping");
15
+ const utils_1 = require("../validator/utils");
16
+ const error_1 = require("../error");
17
+ const help_1 = require("../help");
18
+ const config_1 = require("../config");
19
+ /**
20
+ * @ignore
21
+ */
22
+ exports.PROG_CMD = "__self_cmd";
23
+ /**
24
+ * @ignore
25
+ */
26
+ exports.HELP_CMD = "help";
27
+ /**
28
+ * Command class
29
+ *
30
+ */
31
+ class Command {
32
+ /**
33
+ *
34
+ * @param program
35
+ * @param name
36
+ * @param description
37
+ * @internal
38
+ */
39
+ constructor(program, name, description, config = {}) {
40
+ this._aliases = [];
41
+ /**
42
+ * Command options array
43
+ *
44
+ * @internal
45
+ */
46
+ this.options = [];
47
+ /**
48
+ * Command arguments array
49
+ *
50
+ * @internal
51
+ */
52
+ this.args = [];
53
+ this.program = program;
54
+ this._name = name;
55
+ this.description = description;
56
+ this._config = (0, config_1.createConfigurator)({ visible: true, ...config });
57
+ }
58
+ /**
59
+ * Add one or more aliases so the command can be called by different names.
60
+ *
61
+ * @param aliases Command aliases
62
+ */
63
+ alias(...aliases) {
64
+ this._aliases.push(...aliases);
65
+ return this;
66
+ }
67
+ /**
68
+ * Name getter. Will return an empty string in the program-command context
69
+ *
70
+ * @internal
71
+ */
72
+ get name() {
73
+ return this.isProgramCommand() ? "" : this._name;
74
+ }
75
+ /**
76
+ * Add an argument to the command.
77
+ * Synopsis is a string like `<my-argument>` or `[my-argument]`.
78
+ * Angled brackets (e.g. `<item>`) indicate required input. Square brackets (e.g. `[env]`) indicate optional input.
79
+ *
80
+ * Returns the {@link Command} object to facilitate chaining of methods.
81
+ *
82
+ * @param synopsis Argument synopsis.
83
+ * @param description - Argument description.
84
+ * @param [options] - Optional parameters including validator and default value.
85
+ */
86
+ argument(synopsis, description, options = {}) {
87
+ this._lastAddedArgOrOpt = (0, argument_1.createArgument)(synopsis, description, options);
88
+ this.args.push(this._lastAddedArgOrOpt);
89
+ return this;
90
+ }
91
+ /**
92
+ * Set the corresponding action to execute for this command
93
+ *
94
+ * @param action Action to execute
95
+ */
96
+ action(action) {
97
+ this._action = action;
98
+ return this;
99
+ }
100
+ /**
101
+ * Allow chaining command() calls. See {@link Program.command}.
102
+ *
103
+ */
104
+ command(name, description, config = {}) {
105
+ return this.program.command(name, description, config);
106
+ }
107
+ /**
108
+ * Makes the command the default one for the program.
109
+ */
110
+ default() {
111
+ this.program.defaultCommand = this;
112
+ return this;
113
+ }
114
+ /**
115
+ * Checks if the command has the given alias registered.
116
+ *
117
+ * @param alias
118
+ * @internal
119
+ */
120
+ hasAlias(alias) {
121
+ return this._aliases.includes(alias);
122
+ }
123
+ /**
124
+ * Get command aliases.
125
+ * @internal
126
+ */
127
+ getAliases() {
128
+ return this._aliases;
129
+ }
130
+ /**
131
+ * @internal
132
+ */
133
+ isProgramCommand() {
134
+ return this._name === exports.PROG_CMD;
135
+ }
136
+ /**
137
+ * @internal
138
+ */
139
+ isHelpCommand() {
140
+ return this._name === exports.HELP_CMD;
141
+ }
142
+ /**
143
+ * Hide the command from help.
144
+ * Shortcut to calling `.configure({ visible: false })`.
145
+ */
146
+ hide() {
147
+ return this.configure({ visible: false });
148
+ }
149
+ /**
150
+ * Add an option to the current command.
151
+ *
152
+ * @param synopsis Option synopsis like '-f, --force', or '-f, --file \<file\>', or '--with-openssl [path]'
153
+ * @param description Option description
154
+ * @param options Additional parameters
155
+ */
156
+ option(synopsis, description, options = {}) {
157
+ const opt = (this._lastAddedArgOrOpt = (0, option_1.createOption)(synopsis, description, options));
158
+ this.options.push(opt);
159
+ return this;
160
+ }
161
+ /**
162
+ * @internal
163
+ */
164
+ getParserConfig() {
165
+ const defaults = {
166
+ boolean: [],
167
+ string: [],
168
+ alias: (0, mapping_1.getOptsMapping)(this),
169
+ autoCast: this.autoCast,
170
+ variadic: [],
171
+ ddash: false,
172
+ };
173
+ let parserOpts = this.options.reduce((parserOpts, opt) => {
174
+ if (opt.boolean) {
175
+ parserOpts.boolean.push(opt.name);
176
+ }
177
+ if ((0, utils_1.isStringValidator)(opt.validator)) {
178
+ parserOpts.string.push(opt.name);
179
+ }
180
+ if (opt.variadic) {
181
+ parserOpts.variadic.push(opt.name);
182
+ }
183
+ return parserOpts;
184
+ }, defaults);
185
+ parserOpts = this.args.reduce((parserOpts, arg, index) => {
186
+ if (!this.isProgramCommand()) {
187
+ index++;
188
+ }
189
+ if ((0, utils_1.isBoolValidator)(arg.validator)) {
190
+ parserOpts.boolean.push(index);
191
+ }
192
+ if ((0, utils_1.isStringValidator)(arg.validator)) {
193
+ parserOpts.string.push(index);
194
+ }
195
+ if (arg.variadic) {
196
+ parserOpts.variadic.push(index);
197
+ }
198
+ return parserOpts;
199
+ }, parserOpts);
200
+ return parserOpts;
201
+ }
202
+ /**
203
+ * Return a reformated synopsis string
204
+ * @internal
205
+ */
206
+ get synopsis() {
207
+ const opts = this.options.length
208
+ ? this.options.some((f) => f.required)
209
+ ? "<OPTIONS...>"
210
+ : "[OPTIONS...]"
211
+ : "";
212
+ const name = this._name !== exports.PROG_CMD ? " " + this._name : "";
213
+ return (this.program.getBin() +
214
+ name +
215
+ " " +
216
+ this.args.map((a) => a.synopsis).join(" ") +
217
+ " " +
218
+ opts).trim();
219
+ }
220
+ /**
221
+ * Customize command help. Can be called multiple times to add more paragraphs and/or sections.
222
+ *
223
+ * @param text Help contents
224
+ * @param options Display options
225
+ */
226
+ help(text, options = {}) {
227
+ (0, help_1.customizeHelp)(this, text, options);
228
+ return this;
229
+ }
230
+ /**
231
+ * Configure some behavioral properties.
232
+ *
233
+ * @param props properties to set/update
234
+ */
235
+ configure(props) {
236
+ this._config.set(props);
237
+ return this;
238
+ }
239
+ /**
240
+ * Get a configuration property value.
241
+ *
242
+ * @internal
243
+ * @param key Property key to get value for. See {@link CommandConfig}.
244
+ */
245
+ getConfigProperty(key) {
246
+ return this._config.get(key);
247
+ }
248
+ /**
249
+ * Get the auto-casting flag.
250
+ *
251
+ * @internal
252
+ */
253
+ get autoCast() {
254
+ return (this.getConfigProperty("autoCast") ?? this.program.getConfigProperty("autoCast"));
255
+ }
256
+ /**
257
+ * Auto-complete
258
+ */
259
+ complete(completer) {
260
+ if (!this._lastAddedArgOrOpt) {
261
+ throw new Error("Caporal setup error: you should only call `.complete()` after .argument() or .option().");
262
+ }
263
+ (0, autocomplete_1.registerCompletion)(this._lastAddedArgOrOpt, completer);
264
+ return this;
265
+ }
266
+ /**
267
+ * Toggle strict mode.
268
+ * Shortcut to calling: `.configure({ strictArgsCount: strict, strictOptions: strict }).
269
+ * By default, strict settings are not defined for commands, and inherit from the
270
+ * program settings. Calling `.strict(value)` on a command will override the program
271
+ * settings.
272
+ *
273
+ * @param strict boolean enabled flag
274
+ */
275
+ strict(strict = true) {
276
+ return this.configure({
277
+ strictArgsCount: strict,
278
+ strictOptions: strict,
279
+ });
280
+ }
281
+ /**
282
+ * Computed strictOptions flag.
283
+ *
284
+ * @internal
285
+ */
286
+ get strictOptions() {
287
+ return (this.getConfigProperty("strictOptions") ??
288
+ this.program.getConfigProperty("strictOptions"));
289
+ }
290
+ /**
291
+ * Computed strictArgsCount flag.
292
+ *
293
+ * @internal
294
+ */
295
+ get strictArgsCount() {
296
+ return (this.getConfigProperty("strictArgsCount") ??
297
+ this.program.getConfigProperty("strictArgsCount"));
298
+ }
299
+ /**
300
+ * Enable or disable auto casting of arguments & options for the command.
301
+ * This is basically a shortcut to calling `command.configure({ autoCast: enabled })`.
302
+ * By default, auto-casting is inherited from the program configuration.
303
+ * This method allows overriding what's been set on the program level.
304
+ *
305
+ * @param enabled
306
+ */
307
+ cast(enabled) {
308
+ return this.configure({ autoCast: enabled });
309
+ }
310
+ /**
311
+ * Visible flag
312
+ *
313
+ * @internal
314
+ */
315
+ get visible() {
316
+ return this.getConfigProperty("visible");
317
+ }
318
+ /**
319
+ * Run the action associated with the command
320
+ *
321
+ * @internal
322
+ */
323
+ async run(parsed) {
324
+ const data = {
325
+ args: [],
326
+ options: {},
327
+ line: "",
328
+ rawOptions: {},
329
+ rawArgv: [],
330
+ ddash: [],
331
+ ...parsed,
332
+ };
333
+ try {
334
+ // Validate args and options, including global options
335
+ const result = await (0, validate_call_1.validateCall)(this, data);
336
+ const { args, options, ddash, errors } = result;
337
+ // Process any global options
338
+ const shouldStop = await (0, option_1.processGlobalOptions)(result, this.program, this);
339
+ if (shouldStop) {
340
+ return -1;
341
+ }
342
+ if (errors.length) {
343
+ throw new error_1.ValidationSummaryError(this, errors);
344
+ }
345
+ if (!this._action) {
346
+ throw new error_1.NoActionError(this);
347
+ }
348
+ return await this._action({
349
+ args,
350
+ options,
351
+ ddash,
352
+ logger: logger_1.logger,
353
+ program: this.program,
354
+ command: this,
355
+ });
356
+ }
357
+ catch (err) {
358
+ const ctor = Object.getPrototypeOf(err).constructor.name;
359
+ throw err instanceof error_1.BaseError && ctor !== "Error"
360
+ ? err
361
+ : new error_1.ActionError(err);
362
+ }
363
+ }
364
+ }
365
+ exports.Command = Command;
366
+ /**
367
+ * Create a new command
368
+ *
369
+ * @internal
370
+ */
371
+ function createCommand(...args) {
372
+ return new Command(...args);
373
+ }
374
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/command/index.ts"],"names":[],"mappings":";;;AAqcA,sCAIC;AAzcD;;;GAGG;AACH,mDAA8C;AAC9C,sCAAkC;AAClC,0CAA4C;AAC5C,sCAA8D;AAC9D,kDAAoD;AAEpD,+CAAkD;AAClD,8CAAuE;AAEvE,oCAAwF;AAaxF,kCAAuC;AACvC,sCAA8C;AAE9C;;GAEG;AACU,QAAA,QAAQ,GAAG,YAAY,CAAA;AAEpC;;GAEG;AACU,QAAA,QAAQ,GAAG,MAAM,CAAA;AAE9B;;;GAGG;AACH,MAAa,OAAO;IA0BlB;;;;;;OAMG;IACH,YACE,OAAgB,EAChB,IAAY,EACZ,WAAmB,EACnB,SAAiC,EAAE;QAjC7B,aAAQ,GAAa,EAAE,CAAA;QAS/B;;;;WAIG;QACM,YAAO,GAAa,EAAE,CAAA;QAC/B;;;;WAIG;QACM,SAAI,GAAe,EAAE,CAAA;QAe5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,OAAO,GAAG,IAAA,2BAAkB,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;IACjE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,GAAG,OAAiB;QACxB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAA;QAC9B,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;OAIG;IACH,IAAI,IAAI;QACN,OAAO,IAAI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;YAED,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC;gBACxB,IAAI;gBACJ,OAAO;gBACP,KAAK;gBACL,MAAM,EAAN,eAAM;gBACN,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,OAAO,EAAE,IAAI;aACd,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,IAAI,CAAA;YACxD,MAAM,GAAG,YAAY,iBAAS,IAAI,IAAI,KAAK,OAAO;gBAChD,CAAC,CAAC,GAAG;gBACL,CAAC,CAAC,IAAI,mBAAW,CAAC,GAAY,CAAC,CAAA;QACnC,CAAC;IACH,CAAC;CACF;AAnZD,0BAmZC;AAED;;;;GAIG;AACH,SAAgB,aAAa,CAC3B,GAAG,IAA2C;IAE9C,OAAO,IAAI,OAAO,CAAC,GAAG,IAAI,CAAC,CAAA;AAC7B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Command } from ".";
2
+ import type { Program } from "../program";
3
+ export declare function scanCommands(program: Program, dirPath: string): Promise<Command[]>;
4
+ //# sourceMappingURL=scan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../src/command/scan.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,CAAA;AAChC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEzC,wBAAsB,YAAY,CAChC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,EAAE,CAAC,CAapB"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.scanCommands = scanCommands;
7
+ /**
8
+ * @packageDocumentation
9
+ * @internal
10
+ */
11
+ const path_1 = __importDefault(require("path"));
12
+ const zipObject_1 = __importDefault(require("lodash/zipObject"));
13
+ const map_1 = __importDefault(require("lodash/map"));
14
+ const fs_1 = require("../utils/fs");
15
+ const import_1 = require("./import");
16
+ const _1 = require(".");
17
+ async function scanCommands(program, dirPath) {
18
+ const files = await (0, fs_1.readdir)(dirPath);
19
+ const imp = await Promise.all(files.map((f) => (0, import_1.importCommand)(path_1.default.join(dirPath, f))));
20
+ const data = (0, zipObject_1.default)(files, imp);
21
+ return (0, map_1.default)(data, (cmdBuilder, filename) => {
22
+ const { dir, name } = path_1.default.parse(filename);
23
+ const cmd = dir ? [...dir.split("/"), name].join(" ") : name;
24
+ const options = {
25
+ createCommand: _1.createCommand.bind(null, program, cmd),
26
+ program,
27
+ };
28
+ return cmdBuilder(options);
29
+ });
30
+ }
31
+ //# sourceMappingURL=scan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan.js","sourceRoot":"","sources":["../../../src/command/scan.ts"],"names":[],"mappings":";;;;;AAaA,oCAgBC;AA7BD;;;GAGG;AACH,gDAAuB;AACvB,iEAAwC;AACxC,qDAA4B;AAC5B,oCAAqC;AACrC,qCAAwC;AACxC,wBAAiC;AAI1B,KAAK,UAAU,YAAY,CAChC,OAAgB,EAChB,OAAe;IAEf,MAAM,KAAK,GAAG,MAAM,IAAA,YAAO,EAAC,OAAO,CAAC,CAAA;IACpC,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,sBAAa,EAAC,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACrF,MAAM,IAAI,GAAG,IAAA,mBAAS,EAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAClC,OAAO,IAAA,aAAG,EAAC,IAAI,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE;QACxC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,cAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAC1C,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAC5D,MAAM,OAAO,GAAG;YACd,aAAa,EAAE,gBAAa,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC;YACrD,OAAO;SACR,CAAA;QACD,OAAO,UAAU,CAAC,OAAO,CAAC,CAAA;IAC5B,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * @internal
4
+ */
5
+ import { ParserResult, ParserProcessedResult } from "../types";
6
+ import type { Command } from ".";
7
+ export declare function validateCall(cmd: Command, result: ParserResult): Promise<ParserProcessedResult>;
8
+ //# sourceMappingURL=validate-call.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-call.d.ts","sourceRoot":"","sources":["../../../src/command/validate-call.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAG9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,CAAA;AAEhC,wBAAsB,YAAY,CAChC,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,qBAAqB,CAAC,CAMhC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateCall = validateCall;
4
+ const validate_1 = require("../argument/validate");
5
+ const validate_2 = require("../option/validate");
6
+ async function validateCall(cmd, result) {
7
+ const { args: parsedArgs, options: parsedFlags } = result;
8
+ // check if there are some global flags to handle
9
+ const { options: flags, errors: flagsErrors } = await (0, validate_2.validateOptions)(cmd, parsedFlags);
10
+ const { args, errors: argsErrors } = await (0, validate_1.validateArgs)(cmd, parsedArgs);
11
+ return { ...result, args, options: flags, errors: [...argsErrors, ...flagsErrors] };
12
+ }
13
+ //# sourceMappingURL=validate-call.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-call.js","sourceRoot":"","sources":["../../../src/command/validate-call.ts"],"names":[],"mappings":";;AASA,oCASC;AAbD,mDAAmD;AACnD,iDAAoD;AAG7C,KAAK,UAAU,YAAY,CAChC,GAAY,EACZ,MAAoB;IAEpB,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAAA;IACzD,iDAAiD;IACjD,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,0BAAe,EAAC,GAAG,EAAE,WAAW,CAAC,CAAA;IACvF,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,IAAA,uBAAY,EAAC,GAAG,EAAE,UAAU,CAAC,CAAA;IACxE,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,UAAU,EAAE,GAAG,WAAW,CAAC,EAAE,CAAA;AACrF,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * @internal
4
+ */
5
+ import type { BaseConfig, Configurator } from "../types";
6
+ export declare function createConfigurator<T extends BaseConfig>(defaults: T): Configurator<T>;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAExD,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,UAAU,EAAE,QAAQ,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAmBrF"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createConfigurator = createConfigurator;
4
+ function createConfigurator(defaults) {
5
+ const _defaults = defaults;
6
+ let config = defaults;
7
+ return {
8
+ reset() {
9
+ config = _defaults;
10
+ return config;
11
+ },
12
+ get(key) {
13
+ return config[key];
14
+ },
15
+ getAll() {
16
+ return config;
17
+ },
18
+ set(props) {
19
+ config = { ...config, ...props };
20
+ return config;
21
+ },
22
+ };
23
+ }
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":";;AAMA,gDAmBC;AAnBD,SAAgB,kBAAkB,CAAuB,QAAW;IAClE,MAAM,SAAS,GAAG,QAAQ,CAAA;IAC1B,IAAI,MAAM,GAAG,QAAQ,CAAA;IACrB,OAAO;QACL,KAAK;YACH,MAAM,GAAG,SAAS,CAAA;YAClB,OAAO,MAAM,CAAA;QACf,CAAC;QACD,GAAG,CAAoB,GAAM;YAC3B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;QACpB,CAAC;QACD,MAAM;YACJ,OAAO,MAAM,CAAA;QACf,CAAC;QACD,GAAG,CAAC,KAAiB;YACnB,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK,EAAE,CAAA;YAChC,OAAO,MAAM,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=fatal.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fatal.spec.d.ts","sourceRoot":"","sources":["../../../../src/error/__tests__/fatal.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fatal_1 = require("../fatal");
4
+ const base_1 = require("../base");
5
+ const logger_1 = require("../../logger");
6
+ const vitest_1 = require("vitest");
7
+ (0, vitest_1.describe)("fatalError()", () => {
8
+ const loggerLogSpy = vitest_1.vi.spyOn(logger_1.logger, "log");
9
+ const loggerErrSpy = vitest_1.vi.spyOn(logger_1.logger, "error");
10
+ (0, vitest_1.afterEach)(() => {
11
+ logger_1.logger.level = "info";
12
+ });
13
+ (0, vitest_1.it)("should always call process.exit(1)", () => {
14
+ const err = new base_1.BaseError("my error");
15
+ (0, fatal_1.fatalError)(err);
16
+ (0, vitest_1.expect)(process.exitCode).toEqual(1);
17
+ });
18
+ (0, vitest_1.it)("should always logger.error in normal situation", () => {
19
+ const err = new base_1.BaseError("my error");
20
+ (0, fatal_1.fatalError)(err);
21
+ (0, vitest_1.expect)(loggerErrSpy).toHaveBeenCalledWith(err.message);
22
+ });
23
+ (0, vitest_1.it)("should always logger.log in debug mode, with more info", () => {
24
+ const err = new base_1.BaseError("my error");
25
+ logger_1.logger.level = "debug";
26
+ (0, fatal_1.fatalError)(err);
27
+ (0, vitest_1.expect)(loggerLogSpy).toHaveBeenCalledWith(vitest_1.expect.objectContaining({
28
+ message: vitest_1.expect.stringContaining("my error"),
29
+ stack: err.stack,
30
+ name: "BaseError",
31
+ }));
32
+ });
33
+ });
34
+ //# sourceMappingURL=fatal.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fatal.spec.js","sourceRoot":"","sources":["../../../../src/error/__tests__/fatal.spec.ts"],"names":[],"mappings":";;AAAA,oCAAqC;AACrC,kCAAmC;AACnC,yCAAqC;AACrC,mCAA4D;AAE5D,IAAA,iBAAQ,EAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,MAAM,YAAY,GAAG,WAAE,CAAC,KAAK,CAAC,eAAM,EAAE,KAAK,CAAC,CAAA;IAC5C,MAAM,YAAY,GAAG,WAAE,CAAC,KAAK,CAAC,e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aseError {
7
+ constructor(error: string | Error);
8
+ }
9
+ //# sourceMappingURL=action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/error/action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAElC,qBAAa,WAAY,SAAQ,SAAS;gBAC5B,KAAK,EAAE,MAAM,GAAG,KAAK;CAIlC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /**
3
+ * @packageDocumentation
4
+ * @internal
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ActionError = void 0;
8
+ const base_1 = require("./base");
9
+ class ActionError extends base_1.BaseError {
10
+ constructor(error) {
11
+ const message = typeof error === "string" ? error : error.message;
12
+ super(message, { error });
13
+ }
14
+ }
15
+ exports.ActionError = ActionError;
16
+ //# sourceMappingURL=action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.js","sourceRoot":"","sources":["../../../src/error/action.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iCAAkC;AAElC,MAAa,WAAY,SAAQ,gBAAS;IACxC,YAAY,KAAqB;QAC/B,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAA;QACjE,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;IAC3B,CAAC;CACF;AALD,kCAKC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * @internal
4
+ */
5
+ import { ErrorMetadata } from "../types";
6
+ export type CommonError = Error | BaseError;
7
+ export declare class BaseError extends Error {
8
+ meta: ErrorMetadata;
9
+ constructor(message: string, meta?: ErrorMetadata);
10
+ }
11
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/error/base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,SAAS,CAAA;AAE3C,qBAAa,SAAU,SAAQ,KAAK;IAC3B,IAAI,EAAE,aAAa,CAAA;gBAEd,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,aAAkB;CAOtD"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /**
3
+ * @packageDocumentation
4
+ * @internal
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.BaseError = void 0;
8
+ class BaseError extends Error {
9
+ constructor(message, meta = {}) {
10
+ super(message);
11
+ Object.setPrototypeOf(this, new.target.prototype);
12
+ this.name = this.constructor.name;
13
+ this.meta = meta;
14
+ Error.captureStackTrace(this, this.constructor);
15
+ }
16
+ }
17
+ exports.BaseError = BaseError;
18
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/error/base.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAMH,MAAa,SAAU,SAAQ,KAAK;IAGlC,YAAY,OAAe,EAAE,OAAsB,EAAE;QACnD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;QACjD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;IACjD,CAAC;CACF;AAVD,8BAUC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * @internal
4
+ */
5
+ import type { BaseError } from "./base";
6
+ /**
7
+ * @param err - Error object
8
+ */
9
+ export declare function fatalError(error: BaseError): void;
10
+ //# sourceMappingURL=fatal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fatal.d.ts","sourceRoot":"","sources":["../../../src/error/fatal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAajD"}