git-remote-ops 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 (245) hide show
  1. package/AGENTS.md +177 -0
  2. package/LICENSE +21 -0
  3. package/README.md +247 -0
  4. package/esm/_dnt.shims.js +72 -0
  5. package/esm/cli.js +217 -0
  6. package/esm/client.js +439 -0
  7. package/esm/deps/jsr.io/@cliffy/command/1.1.0/_argument_types.js +1 -0
  8. package/esm/deps/jsr.io/@cliffy/command/1.1.0/_errors.js +133 -0
  9. package/esm/deps/jsr.io/@cliffy/command/1.1.0/_spread.js +1 -0
  10. package/esm/deps/jsr.io/@cliffy/command/1.1.0/_type_utils.js +1 -0
  11. package/esm/deps/jsr.io/@cliffy/command/1.1.0/_utils.js +141 -0
  12. package/esm/deps/jsr.io/@cliffy/command/1.1.0/command.js +1861 -0
  13. package/esm/deps/jsr.io/@cliffy/command/1.1.0/help/_help_generator.js +357 -0
  14. package/esm/deps/jsr.io/@cliffy/command/1.1.0/mod.js +13 -0
  15. package/esm/deps/jsr.io/@cliffy/command/1.1.0/type.js +27 -0
  16. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/action_list.js +16 -0
  17. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/boolean.js +13 -0
  18. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/child_command.js +14 -0
  19. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/command.js +9 -0
  20. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/enum.js +24 -0
  21. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/file.js +12 -0
  22. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/integer.js +9 -0
  23. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/number.js +9 -0
  24. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/secret.js +7 -0
  25. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types/string.js +9 -0
  26. package/esm/deps/jsr.io/@cliffy/command/1.1.0/types.js +2 -0
  27. package/esm/deps/jsr.io/@cliffy/command/1.1.0/upgrade/_check_version.js +26 -0
  28. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/_errors.js +129 -0
  29. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/_utils.js +100 -0
  30. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/_validate_flags.js +166 -0
  31. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/flags.js +750 -0
  32. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/mod.js +55 -0
  33. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types/boolean.js +11 -0
  34. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types/integer.js +9 -0
  35. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types/number.js +11 -0
  36. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types/string.js +4 -0
  37. package/esm/deps/jsr.io/@cliffy/flags/1.1.0/types.js +1 -0
  38. package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/exit.js +16 -0
  39. package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_args.js +11 -0
  40. package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_columns.js +25 -0
  41. package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_env.js +18 -0
  42. package/esm/deps/jsr.io/@cliffy/internal/1.1.0/runtime/inspect.js +11 -0
  43. package/esm/deps/jsr.io/@cliffy/table/1.1.0/_layout.js +616 -0
  44. package/esm/deps/jsr.io/@cliffy/table/1.1.0/_utils.js +79 -0
  45. package/esm/deps/jsr.io/@cliffy/table/1.1.0/border.js +18 -0
  46. package/esm/deps/jsr.io/@cliffy/table/1.1.0/cell.js +190 -0
  47. package/esm/deps/jsr.io/@cliffy/table/1.1.0/column.js +117 -0
  48. package/esm/deps/jsr.io/@cliffy/table/1.1.0/consume_words.js +64 -0
  49. package/esm/deps/jsr.io/@cliffy/table/1.1.0/mod.js +42 -0
  50. package/esm/deps/jsr.io/@cliffy/table/1.1.0/row.js +82 -0
  51. package/esm/deps/jsr.io/@cliffy/table/1.1.0/table.js +341 -0
  52. package/esm/deps/jsr.io/@cliffy/table/1.1.0/unicode_width.js +101 -0
  53. package/esm/deps/jsr.io/@std/crypto/1.1.0/_types.js +2 -0
  54. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.js +237 -0
  55. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.js +2277 -0
  56. package/esm/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.js +46 -0
  57. package/esm/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.js +132 -0
  58. package/esm/deps/jsr.io/@std/crypto/1.1.0/crypto.js +270 -0
  59. package/esm/deps/jsr.io/@std/crypto/1.1.0/mod.js +23 -0
  60. package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.js +61 -0
  61. package/esm/deps/jsr.io/@std/encoding/1.0.10/_common16.js +51 -0
  62. package/esm/deps/jsr.io/@std/encoding/1.0.10/_common_detach.js +13 -0
  63. package/esm/deps/jsr.io/@std/encoding/1.0.10/_types.js +2 -0
  64. package/esm/deps/jsr.io/@std/encoding/1.0.10/hex.js +87 -0
  65. package/esm/deps/jsr.io/@std/fmt/1.0.10/colors.js +903 -0
  66. package/esm/deps/jsr.io/@std/text/1.0.18/closest_string.js +46 -0
  67. package/esm/deps/jsr.io/@std/text/1.0.18/levenshtein_distance.js +127 -0
  68. package/esm/errors.js +38 -0
  69. package/esm/index.js +10 -0
  70. package/esm/logger.js +216 -0
  71. package/esm/objects/commit.js +47 -0
  72. package/esm/objects/index.js +2 -0
  73. package/esm/objects/tree.js +149 -0
  74. package/esm/pack/delta.js +179 -0
  75. package/esm/pack/index.js +3 -0
  76. package/esm/pack/objects.js +72 -0
  77. package/esm/pack/parser.js +304 -0
  78. package/esm/package.json +3 -0
  79. package/esm/protocol/index.js +3 -0
  80. package/esm/protocol/pkt_line.js +103 -0
  81. package/esm/protocol/refs.js +100 -0
  82. package/esm/protocol/upload_pack.js +259 -0
  83. package/esm/transport.js +128 -0
  84. package/esm/types.js +8 -0
  85. package/package.json +50 -0
  86. package/types/_dnt.shims.d.ts +16 -0
  87. package/types/_dnt.shims.d.ts.map +1 -0
  88. package/types/cli.d.ts +3 -0
  89. package/types/cli.d.ts.map +1 -0
  90. package/types/client.d.ts +108 -0
  91. package/types/client.d.ts.map +1 -0
  92. package/types/deps/jsr.io/@cliffy/command/1.1.0/_argument_types.d.ts +163 -0
  93. package/types/deps/jsr.io/@cliffy/command/1.1.0/_argument_types.d.ts.map +1 -0
  94. package/types/deps/jsr.io/@cliffy/command/1.1.0/_errors.d.ts +71 -0
  95. package/types/deps/jsr.io/@cliffy/command/1.1.0/_errors.d.ts.map +1 -0
  96. package/types/deps/jsr.io/@cliffy/command/1.1.0/_spread.d.ts +16 -0
  97. package/types/deps/jsr.io/@cliffy/command/1.1.0/_spread.d.ts.map +1 -0
  98. package/types/deps/jsr.io/@cliffy/command/1.1.0/_type_utils.d.ts +15 -0
  99. package/types/deps/jsr.io/@cliffy/command/1.1.0/_type_utils.d.ts.map +1 -0
  100. package/types/deps/jsr.io/@cliffy/command/1.1.0/_utils.d.ts +38 -0
  101. package/types/deps/jsr.io/@cliffy/command/1.1.0/_utils.d.ts.map +1 -0
  102. package/types/deps/jsr.io/@cliffy/command/1.1.0/command.d.ts +1086 -0
  103. package/types/deps/jsr.io/@cliffy/command/1.1.0/command.d.ts.map +1 -0
  104. package/types/deps/jsr.io/@cliffy/command/1.1.0/help/_help_generator.d.ts +33 -0
  105. package/types/deps/jsr.io/@cliffy/command/1.1.0/help/_help_generator.d.ts.map +1 -0
  106. package/types/deps/jsr.io/@cliffy/command/1.1.0/mod.d.ts +78 -0
  107. package/types/deps/jsr.io/@cliffy/command/1.1.0/mod.d.ts.map +1 -0
  108. package/types/deps/jsr.io/@cliffy/command/1.1.0/type.d.ts +51 -0
  109. package/types/deps/jsr.io/@cliffy/command/1.1.0/type.d.ts.map +1 -0
  110. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/action_list.d.ts +10 -0
  111. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/action_list.d.ts.map +1 -0
  112. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/boolean.d.ts +10 -0
  113. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/boolean.d.ts.map +1 -0
  114. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/child_command.d.ts +10 -0
  115. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/child_command.d.ts.map +1 -0
  116. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/command.d.ts +8 -0
  117. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/command.d.ts.map +1 -0
  118. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/enum.d.ts +11 -0
  119. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/enum.d.ts.map +1 -0
  120. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/file.d.ts +6 -0
  121. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/file.d.ts.map +1 -0
  122. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/integer.d.ts +8 -0
  123. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/integer.d.ts.map +1 -0
  124. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/number.d.ts +8 -0
  125. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/number.d.ts.map +1 -0
  126. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/secret.d.ts +6 -0
  127. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/secret.d.ts.map +1 -0
  128. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/string.d.ts +8 -0
  129. package/types/deps/jsr.io/@cliffy/command/1.1.0/types/string.d.ts.map +1 -0
  130. package/types/deps/jsr.io/@cliffy/command/1.1.0/types.d.ts +161 -0
  131. package/types/deps/jsr.io/@cliffy/command/1.1.0/types.d.ts.map +1 -0
  132. package/types/deps/jsr.io/@cliffy/command/1.1.0/upgrade/_check_version.d.ts +4 -0
  133. package/types/deps/jsr.io/@cliffy/command/1.1.0/upgrade/_check_version.d.ts.map +1 -0
  134. package/types/deps/jsr.io/@cliffy/flags/1.1.0/_errors.d.ts +67 -0
  135. package/types/deps/jsr.io/@cliffy/flags/1.1.0/_errors.d.ts.map +1 -0
  136. package/types/deps/jsr.io/@cliffy/flags/1.1.0/_utils.d.ts +17 -0
  137. package/types/deps/jsr.io/@cliffy/flags/1.1.0/_utils.d.ts.map +1 -0
  138. package/types/deps/jsr.io/@cliffy/flags/1.1.0/_validate_flags.d.ts +11 -0
  139. package/types/deps/jsr.io/@cliffy/flags/1.1.0/_validate_flags.d.ts.map +1 -0
  140. package/types/deps/jsr.io/@cliffy/flags/1.1.0/flags.d.ts +154 -0
  141. package/types/deps/jsr.io/@cliffy/flags/1.1.0/flags.d.ts.map +1 -0
  142. package/types/deps/jsr.io/@cliffy/flags/1.1.0/mod.d.ts +57 -0
  143. package/types/deps/jsr.io/@cliffy/flags/1.1.0/mod.d.ts.map +1 -0
  144. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/boolean.d.ts +4 -0
  145. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/boolean.d.ts.map +1 -0
  146. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/integer.d.ts +4 -0
  147. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/integer.d.ts.map +1 -0
  148. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/number.d.ts +4 -0
  149. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/number.d.ts.map +1 -0
  150. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/string.d.ts +4 -0
  151. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types/string.d.ts.map +1 -0
  152. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types.d.ts +170 -0
  153. package/types/deps/jsr.io/@cliffy/flags/1.1.0/types.d.ts.map +1 -0
  154. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/exit.d.ts +8 -0
  155. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/exit.d.ts.map +1 -0
  156. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_args.d.ts +7 -0
  157. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_args.d.ts.map +1 -0
  158. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_columns.d.ts +7 -0
  159. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_columns.d.ts.map +1 -0
  160. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_env.d.ts +8 -0
  161. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/get_env.d.ts.map +1 -0
  162. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/inspect.d.ts +7 -0
  163. package/types/deps/jsr.io/@cliffy/internal/1.1.0/runtime/inspect.d.ts.map +1 -0
  164. package/types/deps/jsr.io/@cliffy/table/1.1.0/_layout.d.ts +108 -0
  165. package/types/deps/jsr.io/@cliffy/table/1.1.0/_layout.d.ts.map +1 -0
  166. package/types/deps/jsr.io/@cliffy/table/1.1.0/_utils.d.ts +26 -0
  167. package/types/deps/jsr.io/@cliffy/table/1.1.0/_utils.d.ts.map +1 -0
  168. package/types/deps/jsr.io/@cliffy/table/1.1.0/border.d.ts +21 -0
  169. package/types/deps/jsr.io/@cliffy/table/1.1.0/border.d.ts.map +1 -0
  170. package/types/deps/jsr.io/@cliffy/table/1.1.0/cell.d.ts +155 -0
  171. package/types/deps/jsr.io/@cliffy/table/1.1.0/cell.d.ts.map +1 -0
  172. package/types/deps/jsr.io/@cliffy/table/1.1.0/column.d.ts +97 -0
  173. package/types/deps/jsr.io/@cliffy/table/1.1.0/column.d.ts.map +1 -0
  174. package/types/deps/jsr.io/@cliffy/table/1.1.0/consume_words.d.ts +30 -0
  175. package/types/deps/jsr.io/@cliffy/table/1.1.0/consume_words.d.ts.map +1 -0
  176. package/types/deps/jsr.io/@cliffy/table/1.1.0/mod.d.ts +43 -0
  177. package/types/deps/jsr.io/@cliffy/table/1.1.0/mod.d.ts.map +1 -0
  178. package/types/deps/jsr.io/@cliffy/table/1.1.0/row.d.ts +67 -0
  179. package/types/deps/jsr.io/@cliffy/table/1.1.0/row.d.ts.map +1 -0
  180. package/types/deps/jsr.io/@cliffy/table/1.1.0/table.d.ts +235 -0
  181. package/types/deps/jsr.io/@cliffy/table/1.1.0/table.d.ts.map +1 -0
  182. package/types/deps/jsr.io/@cliffy/table/1.1.0/unicode_width.d.ts +40 -0
  183. package/types/deps/jsr.io/@cliffy/table/1.1.0/unicode_width.d.ts.map +1 -0
  184. package/types/deps/jsr.io/@std/crypto/1.1.0/_types.d.ts +9 -0
  185. package/types/deps/jsr.io/@std/crypto/1.1.0/_types.d.ts.map +1 -0
  186. package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.d.ts +2 -0
  187. package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.d.ts.map +1 -0
  188. package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.d.ts +69 -0
  189. package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/lib/deno_std_wasm_crypto.internal.d.ts.map +1 -0
  190. package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.d.ts +13 -0
  191. package/types/deps/jsr.io/@std/crypto/1.1.0/_wasm/mod.d.ts.map +1 -0
  192. package/types/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.d.ts +76 -0
  193. package/types/deps/jsr.io/@std/crypto/1.1.0/aes_gcm.d.ts.map +1 -0
  194. package/types/deps/jsr.io/@std/crypto/1.1.0/crypto.d.ts +149 -0
  195. package/types/deps/jsr.io/@std/crypto/1.1.0/crypto.d.ts.map +1 -0
  196. package/types/deps/jsr.io/@std/crypto/1.1.0/mod.d.ts +22 -0
  197. package/types/deps/jsr.io/@std/crypto/1.1.0/mod.d.ts.map +1 -0
  198. package/types/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts +40 -0
  199. package/types/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts.map +1 -0
  200. package/types/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts +23 -0
  201. package/types/deps/jsr.io/@std/encoding/1.0.10/_common16.d.ts.map +1 -0
  202. package/types/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts +4 -0
  203. package/types/deps/jsr.io/@std/encoding/1.0.10/_common_detach.d.ts.map +1 -0
  204. package/types/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts +9 -0
  205. package/types/deps/jsr.io/@std/encoding/1.0.10/_types.d.ts.map +1 -0
  206. package/types/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts +39 -0
  207. package/types/deps/jsr.io/@std/encoding/1.0.10/hex.d.ts.map +1 -0
  208. package/types/deps/jsr.io/@std/fmt/1.0.10/colors.d.ts +700 -0
  209. package/types/deps/jsr.io/@std/fmt/1.0.10/colors.d.ts.map +1 -0
  210. package/types/deps/jsr.io/@std/text/1.0.18/closest_string.d.ts +42 -0
  211. package/types/deps/jsr.io/@std/text/1.0.18/closest_string.d.ts.map +1 -0
  212. package/types/deps/jsr.io/@std/text/1.0.18/levenshtein_distance.d.ts +23 -0
  213. package/types/deps/jsr.io/@std/text/1.0.18/levenshtein_distance.d.ts.map +1 -0
  214. package/types/errors.d.ts +73 -0
  215. package/types/errors.d.ts.map +1 -0
  216. package/types/index.d.ts +14 -0
  217. package/types/index.d.ts.map +1 -0
  218. package/types/logger.d.ts +70 -0
  219. package/types/logger.d.ts.map +1 -0
  220. package/types/objects/commit.d.ts +23 -0
  221. package/types/objects/commit.d.ts.map +1 -0
  222. package/types/objects/index.d.ts +3 -0
  223. package/types/objects/index.d.ts.map +1 -0
  224. package/types/objects/tree.d.ts +49 -0
  225. package/types/objects/tree.d.ts.map +1 -0
  226. package/types/pack/delta.d.ts +47 -0
  227. package/types/pack/delta.d.ts.map +1 -0
  228. package/types/pack/index.d.ts +4 -0
  229. package/types/pack/index.d.ts.map +1 -0
  230. package/types/pack/objects.d.ts +53 -0
  231. package/types/pack/objects.d.ts.map +1 -0
  232. package/types/pack/parser.d.ts +61 -0
  233. package/types/pack/parser.d.ts.map +1 -0
  234. package/types/protocol/index.d.ts +4 -0
  235. package/types/protocol/index.d.ts.map +1 -0
  236. package/types/protocol/pkt_line.d.ts +44 -0
  237. package/types/protocol/pkt_line.d.ts.map +1 -0
  238. package/types/protocol/refs.d.ts +40 -0
  239. package/types/protocol/refs.d.ts.map +1 -0
  240. package/types/protocol/upload_pack.d.ts +45 -0
  241. package/types/protocol/upload_pack.d.ts.map +1 -0
  242. package/types/transport.d.ts +24 -0
  243. package/types/transport.d.ts.map +1 -0
  244. package/types/types.d.ts +121 -0
  245. package/types/types.d.ts.map +1 -0
@@ -0,0 +1,1086 @@
1
+ import { type ParseFlagsContext } from "../../flags/1.1.0/mod.js";
2
+ import type { IsRequired, MapTypes, MapValue, MergeOptions, TypedArgument, TypedArguments, TypedArgumentValue, TypedCommandArguments, TypedEnv, TypedOption, TypedType } from "./_argument_types.js";
3
+ import type { Merge, Mutable, OneOf, StripInferBound, ValueOf } from "./_type_utils.js";
4
+ import { type HelpOptions } from "./help/_help_generator.js";
5
+ import type { ActionHandler, Argument, ArgumentValue, ArgumentValueHandler, CommandArgumentOptions, CommandOptions, CommandResult, CompleteHandler, CompleteOptions, Completion, DefaultText, DefaultValue, Description, EnvVar, EnvVarOptions, EnvVarValueHandler, ErrorHandler, Example, GlobalEnvVarOptions, GlobalOptionOptions, HelpHandler, Option, OptionOptions, OptionValueHandler, TypeDef, TypeOptions, TypeOrTypeHandler, VersionHandler } from "./types.js";
6
+ import type { ArgumentOptions } from "../../flags/1.1.0/mod.js";
7
+ export interface ArgDefinition extends CommandArgumentOptions<any, any, any> {
8
+ arg: string;
9
+ description?: string;
10
+ }
11
+ interface CommandSettings {
12
+ name: string;
13
+ version?: VersionHandler;
14
+ help?: HelpHandler;
15
+ errorHandler?: ErrorHandler;
16
+ actionHandler?: ActionHandler;
17
+ globalActionHandler?: ActionHandler;
18
+ description: Description;
19
+ usage?: string;
20
+ examples: Array<Example>;
21
+ aliases: Array<string>;
22
+ arguments?: Array<ArgDefinition>;
23
+ throwOnError?: boolean;
24
+ allowEmpty?: boolean;
25
+ stopEarly?: boolean;
26
+ defaultCommand?: string;
27
+ useRawArgs?: boolean;
28
+ isHidden?: boolean;
29
+ isGlobal?: boolean;
30
+ shouldExit?: boolean;
31
+ noGlobals?: boolean;
32
+ meta: Record<string, string>;
33
+ commands: Map<string, Command<any>>;
34
+ versionOptions?: DefaultOption | false;
35
+ helpOptions?: DefaultOption | false;
36
+ autoHelp?: boolean;
37
+ }
38
+ interface CommandProps {
39
+ rawArgs: Array<string>;
40
+ literalArgs: Array<string>;
41
+ hasDefaults?: boolean;
42
+ globalParent?: Command<any>;
43
+ args: Array<Argument>;
44
+ versionOption?: Option;
45
+ helpOption?: Option;
46
+ isRoot?: boolean;
47
+ parsedOptions?: Record<string, unknown>;
48
+ parsedArgs?: unknown[];
49
+ }
50
+ interface BuilderProps {
51
+ groupName: string | null;
52
+ types: Map<string, TypeDef>;
53
+ options: Array<Option>;
54
+ envVars: Array<EnvVar>;
55
+ completions: Map<string, Completion>;
56
+ }
57
+ export interface SubCommandOptions {
58
+ override?: boolean;
59
+ }
60
+ export interface CustomHelpOptions {
61
+ /**
62
+ * If enabled, the help text will be shown automatically when a command, which
63
+ * has subcommands and no action handler defined, is executed without any
64
+ * arguments or options.
65
+ *
66
+ * This allows creating commands that only serve as a container for
67
+ * subcommands and don't have their own action handler, without the need to
68
+ * explicitly show help in the action handler of such commands.
69
+ *
70
+ * This option is enabled by default. To turn off the automatic help display,
71
+ * set this option to `false`.
72
+ */
73
+ auto?: boolean;
74
+ }
75
+ /**
76
+ * Chainable command factory class.
77
+ *
78
+ * The command class can be used to create main and sub commands. All methods
79
+ * from the command class are chainable. Options, arguments, types, etc. that
80
+ * belong to the main command, should be registered before the first sub-command
81
+ * is registered. All options, arguments, etc. that are registered after calling
82
+ * the `.command()` method will be registered to that child-command.
83
+ *
84
+ * When calling the `.reset()` method, options, arguments, etc. will be
85
+ * registered again to the main command.
86
+ *
87
+ * @example Todo cli
88
+ *
89
+ * ```ts
90
+ * import { Command } from "./mod.ts";
91
+ *
92
+ * export const cli = new Command()
93
+ * .name("todo")
94
+ * .description("Todo cli.")
95
+ * .globalOption("--verbose", "Enable verbose output.")
96
+ * .globalEnv("VERBOSE=<value>", "Enable verbose output.")
97
+ * .command("add <todo>", "Add todo.")
98
+ * .action(({ verbose }, todo: string) => {
99
+ * if (verbose) {
100
+ * console.log("Add todo '%s'.", todo);
101
+ * }
102
+ * })
103
+ * .command("delete <id>", "Delete todo.")
104
+ * .action(({ verbose }, id: string) => {
105
+ * if (verbose) {
106
+ * console.log("Delete todo with id '%s'.", id);
107
+ * }
108
+ * });
109
+ *
110
+ * if (import.meta.main) {
111
+ * await cli.parse();
112
+ * }
113
+ * ```
114
+ *
115
+ * @example Use command instance as child command
116
+ *
117
+ * ```ts
118
+ * import { Command } from "./mod.ts";
119
+ *
120
+ * export const addCommand = new Command<{ verbose?: boolean }>()
121
+ * .description("Add todo.")
122
+ * .arguments("<todo>")
123
+ * .action(({ verbose }, todo: string) => {
124
+ * if (verbose) {
125
+ * console.log("Add todo '%s'.", todo);
126
+ * }
127
+ * });
128
+ *
129
+ * export const deleteCommand = new Command<{ verbose?: boolean }>()
130
+ * .description("Delete todo.")
131
+ * .arguments("<id>")
132
+ * .action(({ verbose }, id: string) => {
133
+ * if (verbose) {
134
+ * console.log("Delete todo with id '%s'.", id);
135
+ * }
136
+ * });
137
+ *
138
+ * export const cli = new Command()
139
+ * .name("todo")
140
+ * .description("Todo cli.")
141
+ * .globalOption("--verbose", "Enable verbose output.")
142
+ * .globalEnv("VERBOSE=<value:boolean>", "Enable verbose output.")
143
+ * .command("add", addCommand)
144
+ * .command("delete", deleteCommand);
145
+ *
146
+ * if (import.meta.main) {
147
+ * await cli.parse();
148
+ * }
149
+ * ```
150
+ */
151
+ export declare class Command<TParentCommandGlobals extends Record<string, unknown> | void = void, TParentCommandTypes extends Record<string, unknown> | void = TParentCommandGlobals extends number ? any : void, TCommandOptions extends Record<string, unknown> | void = TParentCommandGlobals extends number ? any : void, TCommandArguments extends Array<unknown> = TParentCommandGlobals extends number ? any : [], TCommandGlobals extends Record<string, unknown> | void = TParentCommandGlobals extends number ? any : void, TCommandTypes extends Record<string, unknown> | void = TParentCommandGlobals extends number ? any : {
152
+ number: number;
153
+ integer: number;
154
+ string: string;
155
+ boolean: boolean;
156
+ file: string;
157
+ secret: string;
158
+ }, TCommandGlobalTypes extends Record<string, unknown> | void = TParentCommandGlobals extends number ? any : void, TParentCommand extends Command<any> | undefined = TParentCommandGlobals extends number ? any : undefined> {
159
+ cmd: Command<any>;
160
+ parent?: TParentCommand;
161
+ props: CommandProps;
162
+ settings: CommandSettings;
163
+ builder: BuilderProps;
164
+ /** Disable version option. */
165
+ versionOption(enable: false): this;
166
+ /**
167
+ * Set global version option.
168
+ *
169
+ * @param flags The flags of the version option.
170
+ * @param desc The description of the version option.
171
+ * @param opts Version option options.
172
+ */
173
+ versionOption(flags: string, desc?: string, opts?: OptionOptions<Partial<TCommandOptions>, TCommandArguments, TCommandGlobals, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand> & {
174
+ global: true;
175
+ }): this;
176
+ /**
177
+ * Set version option.
178
+ *
179
+ * @param flags The flags of the version option.
180
+ * @param desc The description of the version option.
181
+ * @param opts Version option options.
182
+ */
183
+ versionOption(flags: string, desc?: string, opts?: OptionOptions<TCommandOptions, TCommandArguments, TCommandGlobals, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand>): this;
184
+ /**
185
+ * Set version option.
186
+ *
187
+ * @param flags The flags of the version option.
188
+ * @param desc The description of the version option.
189
+ * @param opts The action of the version option.
190
+ */
191
+ versionOption(flags: string, desc?: string, opts?: ActionHandler<TCommandOptions, TCommandArguments, TCommandGlobals, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand>): this;
192
+ /** Disable help option. */
193
+ helpOption(enable: false): this;
194
+ /**
195
+ * Set global help option.
196
+ *
197
+ * @param flags The flags of the help option.
198
+ * @param desc The description of the help option.
199
+ * @param opts Help option options.
200
+ */
201
+ helpOption(flags: string, desc?: string, opts?: OptionOptions<Partial<TCommandOptions>, TCommandArguments, TCommandGlobals, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand> & {
202
+ global: true;
203
+ }): this;
204
+ /**
205
+ * Set help option.
206
+ *
207
+ * @param flags The flags of the help option.
208
+ * @param desc The description of the help option.
209
+ * @param opts Help option options.
210
+ */
211
+ helpOption(flags: string, desc?: string, opts?: OptionOptions<TCommandOptions, TCommandArguments, TCommandGlobals, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand>): this;
212
+ /**
213
+ * Set help option.
214
+ *
215
+ * @param flags The flags of the help option.
216
+ * @param desc The description of the help option.
217
+ * @param opts The action of the help option.
218
+ */
219
+ helpOption(flags: string, desc?: string, opts?: ActionHandler<TCommandOptions, TCommandArguments, TCommandGlobals, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand>): this;
220
+ /**
221
+ * Add new sub-command.
222
+ *
223
+ * @param name Command definition. E.g: `my-command <input-file:string> <output-file:string>`
224
+ * @param cmd The new child command to register.
225
+ * @param options Sub-command options.
226
+ */
227
+ command<TCommand extends Command<(TGlobalOptions & Record<string, unknown>) | void | undefined, TGlobalTypes | void | undefined, Record<string, unknown> | void, Array<unknown>, Record<string, unknown> | void, Record<string, unknown> | void, Record<string, unknown> | void, Command<TGlobalOptions | void | undefined, TGlobalTypes | void | undefined, Record<string, unknown> | void, Array<unknown>, Record<string, unknown> | void, Record<string, unknown> | void, Record<string, unknown> | void, undefined>>, TGlobalOptions extends (TParentCommand extends Command<any> ? TParentCommandGlobals : Merge<TParentCommandGlobals, TCommandGlobals>), TGlobalTypes extends (TParentCommand extends Command<any> ? TParentCommandTypes : Merge<TParentCommandTypes, TCommandTypes>)>(name: string, cmd: TCommand, options?: SubCommandOptions): ReturnType<TCommand["reset"]> extends Command<Record<string, unknown> | void, Record<string, unknown> | void, infer Options, infer Arguments, infer GlobalOptions, infer Types, infer GlobalTypes, undefined> ? Command<TGlobalOptions, TGlobalTypes, Options, Arguments, StripInferBound<GlobalOptions>, Types, GlobalTypes, OneOf<TParentCommand, this>> : never;
228
+ /**
229
+ * Add new sub-command.
230
+ *
231
+ * @param name Command definition. E.g: `my-command <input-file:string> <output-file:string>`
232
+ * @param cmd The new child command to register.
233
+ * @param options Sub-command options.
234
+ */
235
+ command<TCommand extends Command<TGlobalOptions | void | undefined, TGlobalTypes | void | undefined, Record<string, unknown> | void, Array<unknown>, Record<string, unknown> | void, Record<string, unknown> | void, Record<string, unknown> | void, OneOf<TParentCommand, this> | undefined>, TGlobalOptions extends (TParentCommand extends Command<any> ? TParentCommandGlobals : Merge<TParentCommandGlobals, TCommandGlobals>), TGlobalTypes extends (TParentCommand extends Command<any> ? TParentCommandTypes : Merge<TParentCommandTypes, TCommandTypes>)>(name: string, cmd: TCommand, options?: SubCommandOptions): TCommand extends Command<Record<string, unknown> | void, Record<string, unknown> | void, infer Options, infer Arguments, infer GlobalOptions, infer Types, infer GlobalTypes, OneOf<TParentCommand, this> | undefined> ? Command<TGlobalOptions, TGlobalTypes, Options, Arguments, StripInferBound<GlobalOptions>, Types, GlobalTypes, OneOf<TParentCommand, this>> : never;
236
+ /**
237
+ * Add new sub-command.
238
+ *
239
+ * @param nameAndArguments Command definition. E.g: `my-command <input-file:string> <output-file:string>`
240
+ * @param desc The description of the new child command.
241
+ * @param options Sub-command options.
242
+ */
243
+ command<TNameAndArguments extends string, TArguments extends TypedCommandArguments<TNameAndArguments, TParentCommand extends Command<any> ? TParentCommandTypes : Merge<TParentCommandTypes, TCommandGlobalTypes>>>(nameAndArguments: TNameAndArguments, desc?: string, options?: SubCommandOptions): TParentCommandGlobals extends number ? Command<any> : Command<TParentCommand extends Command<any> ? TParentCommandGlobals : Merge<TParentCommandGlobals, TCommandGlobals>, TParentCommand extends Command<any> ? TParentCommandTypes : Merge<TParentCommandTypes, TCommandGlobalTypes>, void, TArguments, void, void, void, OneOf<TParentCommand, this>>;
244
+ /**
245
+ * Add new command alias.
246
+ *
247
+ * @param alias Tha name of the alias.
248
+ */
249
+ alias(alias: string): this;
250
+ /** Reset internal command reference to main command. */
251
+ reset(): OneOf<TParentCommand, this>;
252
+ /**
253
+ * Set internal command pointer to child command with given name.
254
+ * @param name The name of the command to select.
255
+ */
256
+ select<TOptions extends Record<string, unknown> | void = any, TArguments extends Array<unknown> = any, TGlobalOptions extends Record<string, unknown> | void = any>(name: string): Command<TParentCommandGlobals, TParentCommandTypes, TOptions, TArguments, TGlobalOptions, TCommandTypes, TCommandGlobalTypes, TParentCommand>;
257
+ /*****************************************************************************
258
+ **** SUB HANDLER ************************************************************
259
+ *****************************************************************************/
260
+ /**
261
+ * Set command name.
262
+ *
263
+ * This method is usually used to set the command name for the main command.
264
+ * The name should match the name of your program. It is displayed in the auto
265
+ * generated help and used for shell completions by default.
266
+ *
267
+ * When used on child command, the name will be overridden by the command name
268
+ * passed to the parent command when the command is registered with the
269
+ * {@linkcode Command.command}.
270
+ *
271
+ * @param name The name for the command.
272
+ */
273
+ name(name: string): this;
274
+ /**
275
+ * Set command version.
276
+ *
277
+ * Set the version of your cli. The version is displayed in the auto generated
278
+ * help and the output from the [version](./help.md#version-option) option.
279
+ *
280
+ * @param version Semantic version string string or method that returns the version string.
281
+ */
282
+ version(version: string | VersionHandler<Partial<TCommandOptions>, Partial<TCommandArguments>, TCommandGlobals, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand>): this;
283
+ /**
284
+ * Add meta data. Will be displayed in the auto generated help and in the
285
+ * output of the long version.
286
+ *
287
+ * @param name The name/label of the metadata.
288
+ * @param value The value of the metadata.
289
+ */
290
+ meta(name: string, value: string): this;
291
+ /** Returns an object of metadata. */
292
+ getMeta(): Record<string, string>;
293
+ /** Get metadata value by name. */
294
+ getMeta(name: string): string;
295
+ help(helpOptions: HelpOptions & CustomHelpOptions): this;
296
+ help(customHelp: string | HelpHandler, customHelpOptions?: CustomHelpOptions): this;
297
+ /**
298
+ * Set the command description.
299
+ *
300
+ * The description will be displayed in the auto generated help. If the help
301
+ * option is called with the short flag `-h`, only the first line is
302
+ * displayed. If called with the long name `--help`, the full description is
303
+ * displayed.
304
+ *
305
+ * For better multiline formatting, unnecessary indentations and empty leading
306
+ * and trailing lines will be automatically removed.
307
+ *
308
+ * @example Multiline formatting
309
+ *
310
+ * For example, following description:
311
+ *
312
+ * ```ts
313
+ * import { Command } from "https://deno.land/x/cliffy/command/mod.ts";
314
+ *
315
+ * new Command()
316
+ * .description(`
317
+ * This is a multiline description.
318
+ * The indentation of this line will be preserved.
319
+ * `);
320
+ * ```
321
+ *
322
+ * is formatted as follows:
323
+ *
324
+ * ```console
325
+ * This is a multiline description.
326
+ * The indentation of this line will be preserved.
327
+ * ```
328
+ *
329
+ * @param description The command description.
330
+ */
331
+ description(description: Description<TCommandOptions, TCommandArguments, TCommandGlobals, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand>): this;
332
+ /**
333
+ * Set the command usage. Defaults to arguments.
334
+ *
335
+ * With the `.usage()` method you can override the usage text that is
336
+ * displayed at the top of the auto generated help. By default the command
337
+ * arguments are used. The usage is always prefixed with the command name.
338
+ *
339
+ * @example Set custom usage
340
+ *
341
+ * ```ts
342
+ * import { Command } from "https://deno.land/x/cliffy/command/mod.ts";
343
+ *
344
+ * await new Command()
345
+ * .name("script-runner")
346
+ * .description("Simple script runner.")
347
+ * .usage("[options] [script] [script options]")
348
+ * // ...
349
+ * .parse(Deno.args);
350
+ * ```
351
+ *
352
+ * @param usage The command usage.
353
+ */
354
+ usage(usage: string): this;
355
+ /** Hide command from help, completions, etc. */
356
+ hidden(): this;
357
+ /** Make command globally available. */
358
+ global(): this;
359
+ /**
360
+ * Set command arguments.
361
+ *
362
+ * You can use the {@linkcode Command.arguments} method to specify the
363
+ * arguments for the command.
364
+ *
365
+ * This method will override any previously defined arguments.
366
+ *
367
+ * Angled brackets (e.g. `<required>`) indicate required input and
368
+ * square brackets (e.g. `[optional]`) indicate optional input. A required
369
+ * input cannot be defined after an optional input.
370
+ *
371
+ * Arguments can be also defined with the {@linkcode Command.command} method.
372
+ *
373
+ * Optionally you can define [types](./types.md) and
374
+ * [completions](./shell_completions.md) for your arguments after the argument
375
+ * name separated by colon. If no type is specified the type defaults to
376
+ * `string`.
377
+ *
378
+ * @example Define arguments
379
+ *
380
+ * ```ts
381
+ * import { Command } from "@cliffy/command";
382
+ *
383
+ * const cmd = new Command()
384
+ * .name("example")
385
+ * .arguments("<input-file:string> [output-file:string] [...tags:string]", [
386
+ * "The input file.",
387
+ * "The output file.",
388
+ * "Tags for the file."
389
+ * ]);
390
+ *
391
+ * // Parsing arguments
392
+ * const { args } = await cmd.parse(["input.txt", "result.txt", "tag1", "tag2"]);
393
+ *
394
+ * console.log(args); // Output: ['input.txt', 'result.txt', 'tag1', 'tag2']
395
+ * ```
396
+ *
397
+ * @example Use custom types in arguments
398
+ *
399
+ * ```typescript
400
+ * import { Command, EnumType } from "@cliffy/command";
401
+ *
402
+ * await new Command()
403
+ * .type("color", new EnumType(["red", "blue"]))
404
+ * .arguments("<color:color>")
405
+ * .action((_, color: "red" | "blue") => {
406
+ * console.log("color:", color);
407
+ * })
408
+ * .parse(Deno.args);
409
+ * ```
410
+ *
411
+ * @example Variadic arguments
412
+ *
413
+ * The last argument of a command can be variadic. To make an argument
414
+ * variadic you can append or prepend `...` to the argument name (`<...NAME>`
415
+ * or `<NAME...>`).
416
+ *
417
+ * Required rest arguments `<...args>` requires at least one argument, optional
418
+ * rest args `[...args]` are completely optional.
419
+ *
420
+ * ```typescript
421
+ * import { Command } from "https://deno.land/x/cliffy/command/mod.ts";
422
+ *
423
+ * await new Command()
424
+ * .description("Remove directories.")
425
+ * .arguments("<dirs...>")
426
+ * .action((_, ...dirs: Array<string>) => {
427
+ * for (const dir of dirs) {
428
+ * console.log("rmdir %s", dir);
429
+ * }
430
+ * })
431
+ * .parse(Deno.args);
432
+ * ```
433
+ *
434
+ * ```console
435
+ * $ deno run example.ts dir1 dir2 dir3
436
+ * rmdir dir1
437
+ * rmdir dir2
438
+ * rmdir dir3
439
+ * ```
440
+ *
441
+ * @param args The arguments definition string.
442
+ * @param descriptions The argument descriptions.
443
+ * @returns The command instance.
444
+ */
445
+ arguments<TArguments extends TypedArguments<TArgs, Merge<TParentCommandTypes, Merge<TCommandGlobalTypes, TCommandTypes>>>, TArgs extends string = string>(args: TArgs, descriptions?: Array<string>): Command<TParentCommandGlobals, TParentCommandTypes, TCommandOptions, TArguments, TCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommand>;
446
+ /**
447
+ * Add a new command argument.
448
+ *
449
+ * - When called multiple times, arguments are appended in the order of calls.
450
+ * - When called after `arguments()`, the new argument is appended after the previously
451
+ * defined arguments.
452
+ * - When called before `arguments()`, the new argument is overwritten by the later
453
+ * defined arguments.
454
+ *
455
+ * @example
456
+ * ```ts
457
+ * import { Command } from "@cliffy/command";
458
+ *
459
+ * const cmd = new Command()
460
+ * .name("example")
461
+ * .argument("<input-file:string>", "The input file.")
462
+ * .argument("[output-file:string]", "The output file.", { default: "out.txt" })
463
+ * .argument("[...tags:string]", "Tags for the file.");
464
+ *
465
+ * // Parsing arguments
466
+ * const { args } = await cmd.parse(["input.txt", "result.txt", "tag1", "tag2"]);
467
+ *
468
+ * console.log(args); // Output: ['input.txt', 'result.txt', 'tag1', 'tag2']
469
+ * ```
470
+ *
471
+ * @param arg The argument definition. E.g: `<input-file:string>`
472
+ * @param description The argument description.
473
+ * @param opts Argument options.
474
+ * @returns The command instance.
475
+ */
476
+ argument<TArguments extends TypedArgument<TArg, Merge<TParentCommandTypes, Merge<TCommandGlobalTypes, TCommandTypes>>, TDefaultValue>, const TArg extends string = string, const TDefaultValue extends (TArg extends `${string}...${string}` ? ReadonlyArray<unknown> | undefined : unknown) = undefined, TMappedArguments = undefined, TValue = MapTypes<TypedArgumentValue<TArg, Merge<TParentCommandTypes, Merge<TCommandGlobalTypes, TCommandTypes>>, Mutable<TDefaultValue>>>>(arg: TArg, description: string, opts?: CommandArgumentOptions<TDefaultValue, TValue, TMappedArguments> | ArgumentValueHandler<TValue, TMappedArguments>): Command<TParentCommandGlobals, TParentCommandTypes, TCommandOptions, [
477
+ ...TCommandArguments,
478
+ ...TMappedArguments extends undefined ? TArguments : TArg extends `${string}...${string}` ? TMappedArguments extends ReadonlyArray<unknown> ? TMappedArguments : IsRequired<TArg extends `<${string}>` ? true : false, TDefaultValue> extends true ? [Awaited<TMappedArguments>] : [Awaited<TMappedArguments>?] : IsRequired<TArg extends `<${string}>` ? true : false, TDefaultValue> extends true ? [Awaited<TMappedArguments>] : [Awaited<TMappedArguments>?]
479
+ ], TCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommand>;
480
+ /**
481
+ * Set command callback method.
482
+ *
483
+ * @param fn Command action handler.
484
+ */
485
+ action(fn: ActionHandler<TCommandOptions, TCommandArguments, TCommandGlobals, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand>): this;
486
+ /**
487
+ * Set command callback method.
488
+ *
489
+ * @param fn Command action handler.
490
+ */
491
+ globalAction(fn: ActionHandler<Partial<TCommandOptions>, Array<unknown>, TCommandGlobals, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand>): this;
492
+ /**
493
+ * Don't throw an error if the command was called without arguments.
494
+ *
495
+ * @param allowEmpty Enable/disable allow empty.
496
+ */
497
+ allowEmpty<TAllowEmpty extends boolean | undefined = undefined>(allowEmpty?: TAllowEmpty): false extends TAllowEmpty ? this : Command<Partial<TParentCommandGlobals>, TParentCommandTypes, Partial<TCommandOptions>, TCommandArguments, TCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommand>;
498
+ /**
499
+ * Enable stop early. If enabled, all arguments starting from the first non
500
+ * option argument will be passed as arguments with type string to the command
501
+ * action handler.
502
+ *
503
+ * For example:
504
+ * `command --debug-level warning server --port 80`
505
+ *
506
+ * Will result in:
507
+ * - options: `{ debugLevel: 'warning' }`
508
+ * - args: `['server', '--port', '80']`
509
+ *
510
+ * @param stopEarly Enable/disable stop early.
511
+ */
512
+ stopEarly(stopEarly?: boolean): this;
513
+ /**
514
+ * Disable parsing arguments. If enabled the raw arguments will be passed to
515
+ * the action handler. This has no effect for parent or child commands. Only
516
+ * for the command on which this method was called.
517
+ *
518
+ * @param useRawArgs Enable/disable raw arguments.
519
+ */
520
+ useRawArgs(useRawArgs?: boolean): Command<void, void, void, Array<string>, void, void, void, TParentCommand>;
521
+ /**
522
+ * Set default command.
523
+ *
524
+ * The default command is executed when the command was called without any
525
+ * additional arguments.
526
+ *
527
+ * @param name Name of the default command.
528
+ */
529
+ default(name: string): this;
530
+ globalType<THandler extends TypeOrTypeHandler<unknown>, TName extends string = string>(name: TName, handler: THandler, options?: Omit<TypeOptions, "global">): Command<TParentCommandGlobals, TParentCommandTypes, TCommandOptions, TCommandArguments, TCommandGlobals, TCommandTypes, Merge<TCommandGlobalTypes, TypedType<TName, THandler>>, TParentCommand>;
531
+ /**
532
+ * Register custom type.
533
+ *
534
+ * @param name The name of the type.
535
+ * @param handler The callback method to parse the type.
536
+ * @param options Type options.
537
+ */
538
+ type<THandler extends TypeOrTypeHandler<unknown>, TName extends string = string>(name: TName, handler: THandler, options?: TypeOptions): Command<TParentCommandGlobals, TParentCommandTypes, TCommandOptions, TCommandArguments, TCommandGlobals, Merge<TCommandTypes, TypedType<TName, THandler>>, TCommandGlobalTypes, TParentCommand>;
539
+ /**
540
+ * Register global complete handler.
541
+ *
542
+ * @param name The name of the completion.
543
+ * @param complete The callback method to complete the type.
544
+ * @param options Complete options.
545
+ */
546
+ globalComplete(name: string, complete: CompleteHandler, options?: Omit<CompleteOptions, "global">): this;
547
+ /**
548
+ * Register global complete handler.
549
+ *
550
+ * @param name The name of the completion.
551
+ * @param complete The callback method to complete the type.
552
+ * @param options Complete options.
553
+ */
554
+ complete(name: string, complete: CompleteHandler<Partial<TCommandOptions>, Partial<TCommandArguments>, TCommandGlobals, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, any>, options: CompleteOptions & {
555
+ global: boolean;
556
+ }): this;
557
+ /**
558
+ * Register complete handler.
559
+ *
560
+ * @param name The name of the completion.
561
+ * @param complete The callback method to complete the type.
562
+ * @param options Complete options.
563
+ */
564
+ complete(name: string, complete: CompleteHandler<TCommandOptions, TCommandArguments, TCommandGlobals, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand>, options?: CompleteOptions): this;
565
+ /**
566
+ * Throw validation errors instead of calling `exit()` to handle
567
+ * validation errors manually.
568
+ *
569
+ * A validation error is thrown when the command is wrongly used by the user.
570
+ * For example: If the user passes some invalid options or arguments to the
571
+ * command.
572
+ *
573
+ * This has no effect for parent commands. Only for the command on which this
574
+ * method was called and all child commands.
575
+ *
576
+ * **Example:**
577
+ *
578
+ * ```ts
579
+ * import { Command, ValidationError } from "./mod.ts";
580
+ *
581
+ * const cmd = new Command();
582
+ * // ...
583
+ *
584
+ * try {
585
+ * cmd.parse();
586
+ * } catch(error) {
587
+ * if (error instanceof ValidationError) {
588
+ * cmd.showHelp();
589
+ * Deno.exit(1);
590
+ * }
591
+ * throw error;
592
+ * }
593
+ * ```
594
+ *
595
+ * @see ValidationError
596
+ */
597
+ throwErrors(): this;
598
+ /**
599
+ * Set custom error handler.
600
+ *
601
+ * @param handler Error handler callback function.
602
+ */
603
+ error(handler: ErrorHandler<CommandOptions<TCommandOptions, TCommandGlobals, TParentCommandGlobals>, MapTypes<TCommandArguments>>): this;
604
+ /** Get error handler callback function. */
605
+ private getErrorHandler;
606
+ /**
607
+ * Same as `.throwErrors()` but also prevents calling `exit()` after
608
+ * printing help or version with the --help and --version option.
609
+ */
610
+ noExit(): this;
611
+ /**
612
+ * Disable inheriting global commands, options and environment variables from
613
+ * parent commands.
614
+ */
615
+ noGlobals(): this;
616
+ /** Check whether the command should throw errors or exit. */
617
+ protected shouldThrowErrors(): boolean;
618
+ /** Check whether the command should exit after printing help or version. */
619
+ protected shouldExit(): boolean;
620
+ /**
621
+ * Enable grouping of options and set the name of the group.
622
+ * All option which are added after calling the `.group()` method will be
623
+ * grouped in the help output. If the `.group()` method can be use multiple
624
+ * times to create more groups.
625
+ *
626
+ * @param name The name of the option group.
627
+ */
628
+ group(name: string | null): this;
629
+ /**
630
+ * Register a global option.
631
+ *
632
+ * @param flags Flags string e.g: -h, --help, --manual <requiredArg:string> [optionalArg:number] [...restArgs:string]
633
+ * @param desc Flag description.
634
+ * @param opts Flag options or custom handler for processing flag value.
635
+ */
636
+ globalOption<TFlags extends string, TGlobalOptions extends TypedOption<TFlags, TCommandOptions, Merge<TParentCommandTypes, Merge<TCommandGlobalTypes, TCommandTypes>>, undefined extends TConflicts ? TRequired : false, TDefaultValue>, TMappedGlobalOptions extends MapValue<TGlobalOptions, TMappedValue, TCollect>, TRequired extends OptionOptions["required"] = undefined, TCollect extends OptionOptions["collect"] = undefined, TConflicts extends OptionOptions["conflicts"] = undefined, const TDefaultValue = undefined, TMappedValue = undefined>(flags: TFlags, desc: string, opts?: Omit<GlobalOptionOptions<Partial<TCommandOptions>, TCommandArguments, MergeOptions<TFlags, TCommandGlobals, TGlobalOptions>, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand, TDefaultValue>, "value"> & {
637
+ default?: DefaultValue<TDefaultValue>;
638
+ defaultText?: DefaultText<TDefaultValue>;
639
+ required?: TRequired;
640
+ collect?: TCollect;
641
+ value?: OptionValueHandler<MapTypes<ValueOf<TGlobalOptions>>, TMappedValue>;
642
+ } | OptionValueHandler<MapTypes<ValueOf<TGlobalOptions>>, TMappedValue>): Command<TParentCommandGlobals, TParentCommandTypes, TCommandOptions, TCommandArguments, MergeOptions<TFlags, TCommandGlobals, TMappedGlobalOptions>, TCommandTypes, TCommandGlobalTypes, TParentCommand>;
643
+ /**
644
+ * Add a global option.
645
+ *
646
+ * @param flags Flags string e.g: -h, --help, --manual <requiredArg:string> [optionalArg:number] [...restArgs:string]
647
+ * @param desc Flag description.
648
+ * @param opts Flag options or custom handler for processing flag value.
649
+ */
650
+ option<TFlags extends string, TGlobalOptions extends TypedOption<TFlags, TCommandOptions, Merge<TParentCommandTypes, Merge<TCommandGlobalTypes, TCommandTypes>>, undefined extends TConflicts ? TRequired : false, TDefaultValue>, TMappedGlobalOptions extends MapValue<TGlobalOptions, TMappedValue, TCollect>, TRequired extends OptionOptions["required"] = undefined, TCollect extends OptionOptions["collect"] = undefined, TConflicts extends OptionOptions["conflicts"] = undefined, const TDefaultValue = undefined, TMappedValue = undefined>(flags: TFlags, desc: string, opts: Omit<OptionOptions<Partial<TCommandOptions>, TCommandArguments, MergeOptions<TFlags, TCommandGlobals, TGlobalOptions>, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand, TDefaultValue>, "value"> & {
651
+ global: true;
652
+ default?: DefaultValue<TDefaultValue>;
653
+ defaultText?: DefaultText<TDefaultValue>;
654
+ required?: TRequired;
655
+ collect?: TCollect;
656
+ value?: OptionValueHandler<MapTypes<ValueOf<TGlobalOptions>>, TMappedValue>;
657
+ } | OptionValueHandler<MapTypes<ValueOf<TGlobalOptions>>, TMappedValue>): Command<TParentCommandGlobals, TParentCommandTypes, TCommandOptions, TCommandArguments, MergeOptions<TFlags, TCommandGlobals, TMappedGlobalOptions>, TCommandTypes, TCommandGlobalTypes, TParentCommand>;
658
+ /**
659
+ * Register an option.
660
+ *
661
+ * @param flags Flags string e.g: -h, --help, --manual <requiredArg:string> [optionalArg:number] [...restArgs:string]
662
+ * @param desc Flag description.
663
+ * @param opts Flag options or custom handler for processing flag value.
664
+ */
665
+ option<TFlags extends string, TOptions extends TypedOption<TFlags, TCommandOptions, Merge<TParentCommandTypes, Merge<TCommandGlobalTypes, TCommandTypes>>, undefined extends TConflicts ? TRequired : false, TDefaultValue>, TMappedOptions extends MapValue<TOptions, TMappedValue, TCollect>, TRequired extends OptionOptions["required"] = undefined, TCollect extends OptionOptions["collect"] = undefined, TConflicts extends OptionOptions["conflicts"] = undefined, const TDefaultValue = undefined, TMappedValue = undefined>(flags: TFlags, desc: string, opts?: Omit<OptionOptions<MergeOptions<TFlags, TCommandOptions, TMappedOptions>, TCommandArguments, TCommandGlobals, TParentCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand, TDefaultValue>, "value"> & {
666
+ default?: DefaultValue<TDefaultValue>;
667
+ defaultText?: DefaultText<TDefaultValue>;
668
+ required?: TRequired;
669
+ collect?: TCollect;
670
+ conflicts?: TConflicts;
671
+ value?: OptionValueHandler<MapTypes<ValueOf<TOptions>>, TMappedValue>;
672
+ } | OptionValueHandler<MapTypes<ValueOf<TOptions>>, TMappedValue>): Command<TParentCommandGlobals, TParentCommandTypes, MergeOptions<TFlags, TCommandOptions, TMappedOptions>, TCommandArguments, TCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommand>;
673
+ /**
674
+ * Register command example.
675
+ *
676
+ * @param name Name of the example.
677
+ * @param description The content of the example.
678
+ */
679
+ example(name: string, description: string): this;
680
+ /**
681
+ * @param flags Flags string e.g: -h, --help, --manual <requiredArg:string> [optionalArg:number] [...restArgs:string]
682
+ * @param desc Flag description.
683
+ * @param opts Flag options or custom handler for processing flag value.
684
+ */
685
+ /**
686
+ * Register a global environment variable.
687
+ *
688
+ * @param name Name of the environment variable.
689
+ * @param description The description of the environment variable.
690
+ * @param options Environment variable options.
691
+ */
692
+ globalEnv<TNameAndValue extends string, TGlobalEnvVars extends TypedEnv<TNameAndValue, TPrefix, TCommandOptions, Merge<TParentCommandTypes, Merge<TCommandGlobalTypes, TCommandTypes>>, TRequired>, TMappedGlobalEnvVars extends MapValue<TGlobalEnvVars, TMappedValue>, TRequired extends EnvVarOptions["required"] = undefined, TPrefix extends EnvVarOptions["prefix"] = undefined, TMappedValue = undefined>(name: TNameAndValue, description: string, options?: Omit<GlobalEnvVarOptions, "value"> & {
693
+ required?: TRequired;
694
+ prefix?: TPrefix;
695
+ value?: EnvVarValueHandler<MapTypes<ValueOf<TGlobalEnvVars>>, TMappedValue>;
696
+ }): Command<TParentCommandGlobals, TParentCommandTypes, TCommandOptions, TCommandArguments, Merge<TCommandGlobals, TMappedGlobalEnvVars>, TCommandTypes, TCommandGlobalTypes, TParentCommand>;
697
+ /**
698
+ * Register a global environment variable.
699
+ *
700
+ * @param name Name of the environment variable.
701
+ * @param description The description of the environment variable.
702
+ * @param options Environment variable options.
703
+ */
704
+ env<N extends string, G extends TypedEnv<N, P, TCommandOptions, Merge<TParentCommandTypes, Merge<TCommandGlobalTypes, TCommandTypes>>, R>, MG extends MapValue<G, V>, R extends EnvVarOptions["required"] = undefined, P extends EnvVarOptions["prefix"] = undefined, V = undefined>(name: N, description: string, options: Omit<EnvVarOptions, "value"> & {
705
+ global: true;
706
+ required?: R;
707
+ prefix?: P;
708
+ value?: EnvVarValueHandler<MapTypes<ValueOf<G>>, V>;
709
+ }): Command<TParentCommandGlobals, TParentCommandTypes, TCommandOptions, TCommandArguments, Merge<TCommandGlobals, MG>, TCommandTypes, TCommandGlobalTypes, TParentCommand>;
710
+ /**
711
+ * Register an environment variable.
712
+ *
713
+ * @param name Name of the environment variable.
714
+ * @param description The description of the environment variable.
715
+ * @param options Environment variable options.
716
+ */
717
+ env<TNameAndValue extends string, TEnvVar extends TypedEnv<TNameAndValue, TPrefix, TCommandOptions, Merge<TParentCommandTypes, Merge<TCommandGlobalTypes, TCommandTypes>>, TRequired>, TMappedEnvVar extends MapValue<TEnvVar, TMappedValue>, TRequired extends EnvVarOptions["required"] = undefined, TPrefix extends EnvVarOptions["prefix"] = undefined, TMappedValue = undefined>(name: TNameAndValue, description: string, options?: Omit<EnvVarOptions, "value"> & {
718
+ required?: TRequired;
719
+ prefix?: TPrefix;
720
+ value?: EnvVarValueHandler<MapTypes<ValueOf<TEnvVar>>, TMappedValue>;
721
+ }): Command<TParentCommandGlobals, TParentCommandTypes, Merge<TCommandOptions, TMappedEnvVar>, TCommandArguments, TCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommand>;
722
+ /*****************************************************************************
723
+ **** MAIN HANDLER ***********************************************************
724
+ *****************************************************************************/
725
+ /**
726
+ * Parse command line arguments and execute matched command.
727
+ *
728
+ * @param args Command line args to parse. Ex: `cmd.parse( Deno.args )`
729
+ */
730
+ parse(args?: string[]): Promise<TParentCommand extends Command<any> ? CommandResult<Record<string, unknown>, Array<unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, Record<string, unknown>, undefined> : CommandResult<MapTypes<TCommandOptions>, MapTypes<TCommandArguments>, MapTypes<TCommandGlobals>, MapTypes<TParentCommandGlobals>, TCommandTypes, TCommandGlobalTypes, TParentCommandTypes, TParentCommand>>;
731
+ private parseCommand;
732
+ private getSubCommand;
733
+ private parseGlobalOptionsAndEnvVars;
734
+ private parseOptionsAndEnvVars;
735
+ /** Register default options like `--version` and `--help`. */
736
+ private registerDefaults;
737
+ /**
738
+ * Execute command.
739
+ * @param options A map of all options and environment variables. This also
740
+ * includes global options and environment variables. The options are parsed
741
+ * and processed by the command before passed to the action handler.
742
+ * @param args Positional arguments array.
743
+ * @param ctx Parse context.
744
+ */
745
+ private execute;
746
+ private executeGlobalAction;
747
+ /** Parse raw command line arguments. */
748
+ protected parseOptions(ctx: ParseContext, options: Option[], { stopEarly, stopOnUnknown, dotted, args, }?: ParseOptionsOptions): void;
749
+ /** Parse argument type. */
750
+ protected parseType(type: ArgumentValue): unknown;
751
+ /**
752
+ * Read and validate environment variables.
753
+ * @param ctx Parse context.
754
+ * @param envVars env vars defined by the command.
755
+ * @param validate when true, throws an error if a required env var is missing.
756
+ */
757
+ protected parseEnvVars(ctx: ParseContext, envVars: Array<EnvVar>, validate?: boolean): Promise<void>;
758
+ protected findEnvVar(names: readonly string[]): Promise<{
759
+ name: string;
760
+ value: string;
761
+ } | undefined>;
762
+ /**
763
+ * Processes command-line arguments.
764
+ *
765
+ * @param ctx Parse context.
766
+ */
767
+ private processArguments;
768
+ private handleError;
769
+ /**
770
+ * Handle error. If `throwErrors` is enabled the error will be thrown,
771
+ * otherwise a formatted error message will be printed and `exit(1)`
772
+ * will be called. This will also trigger registered error handlers.
773
+ *
774
+ * @param error The error to handle.
775
+ */
776
+ throw(error: Error): never;
777
+ /*****************************************************************************
778
+ **** GETTER *****************************************************************
779
+ *****************************************************************************/
780
+ /** Get command name. */
781
+ getName(): string;
782
+ /** Get parent command. */
783
+ getParent(): TParentCommand;
784
+ /**
785
+ * Get parent command from global executed command.
786
+ * Be sure, to call this method only inside an action handler. Unless this or any child command was executed,
787
+ * this method returns always undefined.
788
+ */
789
+ getGlobalParent(): Command<any> | undefined;
790
+ /** Get main command. */
791
+ getMainCommand(): Command<any>;
792
+ /** Get command name aliases. */
793
+ getAliases(): string[];
794
+ /**
795
+ * Get full command path.
796
+ *
797
+ * @param name Override the main command name.
798
+ */
799
+ getPath(name?: string): string;
800
+ /** Get arguments definition. E.g: <input-file:string> <output-file:string> */
801
+ getArgsDefinition(): string | undefined;
802
+ /**
803
+ * Get argument by name.
804
+ *
805
+ * @param name Name of the argument.
806
+ */
807
+ getArgument(name: string): Argument | undefined;
808
+ /** Get arguments. */
809
+ getArguments(): Argument[];
810
+ /** Check if command has arguments. */
811
+ hasArguments(): boolean;
812
+ /** Get command version. */
813
+ getVersion(): string | undefined;
814
+ /** Get help handler method. */
815
+ private getVersionHandler;
816
+ /** Get command description. */
817
+ getDescription(): string;
818
+ /** Get auto generated command usage. */
819
+ getUsage(): string;
820
+ private getRequiredOptionsDefinition;
821
+ /** Get short command description. This is the first line of the description. */
822
+ getShortDescription(): string;
823
+ /** Get original command-line arguments. */
824
+ getRawArgs(): string[];
825
+ /** Get all arguments defined after the double dash. */
826
+ getLiteralArgs(): string[];
827
+ /** Output generated help without exiting. */
828
+ showVersion(): void;
829
+ /** Returns command name, version and meta data. */
830
+ getLongVersion(): string;
831
+ /** Outputs command name, version and meta data. */
832
+ showLongVersion(): void;
833
+ /** Output generated help without exiting. */
834
+ showHelp(options?: HelpOptions): void;
835
+ /** Get generated help. */
836
+ getHelp(options?: HelpOptions): string;
837
+ /** Get help handler method. */
838
+ private getHelpHandler;
839
+ private exit;
840
+ /*****************************************************************************
841
+ **** Options GETTER *********************************************************
842
+ *****************************************************************************/
843
+ /**
844
+ * Checks whether the command has options or not.
845
+ *
846
+ * @param hidden Include hidden options.
847
+ */
848
+ hasOptions(hidden?: boolean): boolean;
849
+ /**
850
+ * Get options.
851
+ *
852
+ * @param hidden Include hidden options.
853
+ */
854
+ getOptions(hidden?: boolean): Option[];
855
+ /**
856
+ * Get base options.
857
+ *
858
+ * @param hidden Include hidden options.
859
+ */
860
+ getBaseOptions(hidden?: boolean): Option[];
861
+ /**
862
+ * Get global options.
863
+ *
864
+ * @param hidden Include hidden options.
865
+ */
866
+ getGlobalOptions(hidden?: boolean): Option[];
867
+ /**
868
+ * Checks whether the command has an option with given name or not.
869
+ *
870
+ * @param name Name of the option. Must be in param-case.
871
+ * @param hidden Include hidden options.
872
+ */
873
+ hasOption(name: string, hidden?: boolean): boolean;
874
+ /**
875
+ * Get option by name.
876
+ *
877
+ * @param name Name of the option. Must be in param-case.
878
+ * @param hidden Include hidden options.
879
+ */
880
+ getOption(name: string, hidden?: boolean): Option | undefined;
881
+ /**
882
+ * Get base option by name.
883
+ *
884
+ * @param name Name of the option. Must be in param-case.
885
+ * @param hidden Include hidden options.
886
+ */
887
+ getBaseOption(name: string, hidden?: boolean): Option | undefined;
888
+ /**
889
+ * Get global option from parent commands by name.
890
+ *
891
+ * @param name Name of the option. Must be in param-case.
892
+ * @param hidden Include hidden options.
893
+ */
894
+ getGlobalOption(name: string, hidden?: boolean): Option | undefined;
895
+ /**
896
+ * Remove option by name.
897
+ *
898
+ * @param name Name of the option. Must be in param-case.
899
+ */
900
+ removeOption(name: string): Option | undefined;
901
+ /**
902
+ * Checks whether the command has sub-commands or not.
903
+ *
904
+ * @param hidden Include hidden commands.
905
+ */
906
+ hasCommands(hidden?: boolean): boolean;
907
+ /**
908
+ * Get commands.
909
+ *
910
+ * @param hidden Include hidden commands.
911
+ */
912
+ getCommands(hidden?: boolean): Array<Command<any>>;
913
+ /**
914
+ * Get base commands.
915
+ *
916
+ * @param hidden Include hidden commands.
917
+ */
918
+ getBaseCommands(hidden?: boolean): Array<Command<any>>;
919
+ /**
920
+ * Get global commands.
921
+ *
922
+ * @param hidden Include hidden commands.
923
+ */
924
+ getGlobalCommands(hidden?: boolean): Array<Command<any>>;
925
+ /**
926
+ * Checks whether a child command exists by given name or alias.
927
+ *
928
+ * @param name Name or alias of the command.
929
+ * @param hidden Include hidden commands.
930
+ */
931
+ hasCommand(name: string, hidden?: boolean): boolean;
932
+ /**
933
+ * Get command by name or alias.
934
+ *
935
+ * @param name Name or alias of the command.
936
+ * @param hidden Include hidden commands.
937
+ */
938
+ getCommand<TCommand extends Command<any>>(name: string, hidden?: boolean): TCommand | undefined;
939
+ /**
940
+ * Get base command by name or alias.
941
+ *
942
+ * @param name Name or alias of the command.
943
+ * @param hidden Include hidden commands.
944
+ */
945
+ getBaseCommand<TCommand extends Command<any>>(name: string, hidden?: boolean): TCommand | undefined;
946
+ /**
947
+ * Get global command by name or alias.
948
+ *
949
+ * @param name Name or alias of the command.
950
+ * @param hidden Include hidden commands.
951
+ */
952
+ getGlobalCommand<TCommand extends Command<any>>(name: string, hidden?: boolean): TCommand | undefined;
953
+ /**
954
+ * Remove sub-command by name or alias.
955
+ *
956
+ * @param name Name or alias of the command.
957
+ */
958
+ removeCommand(name: string): Command<any> | undefined;
959
+ /** Get types. */
960
+ getTypes(): Array<TypeDef>;
961
+ /** Get base types. */
962
+ getBaseTypes(): Array<TypeDef>;
963
+ /** Get global types. */
964
+ getGlobalTypes(): Array<TypeDef>;
965
+ /**
966
+ * Get type by name.
967
+ *
968
+ * @param name Name of the type.
969
+ */
970
+ getType(name: string): TypeDef | undefined;
971
+ /**
972
+ * Get base type by name.
973
+ *
974
+ * @param name Name of the type.
975
+ */
976
+ getBaseType(name: string): TypeDef | undefined;
977
+ /**
978
+ * Get global type by name.
979
+ *
980
+ * @param name Name of the type.
981
+ */
982
+ getGlobalType(name: string): TypeDef | undefined;
983
+ /** Get completions. */
984
+ getCompletions(): Completion<any, any, any, any, any, any, any, any>[];
985
+ /** Get base completions. */
986
+ getBaseCompletions(): Completion[];
987
+ /** Get global completions. */
988
+ getGlobalCompletions(): Completion[];
989
+ /**
990
+ * Get completion by name.
991
+ *
992
+ * @param name Name of the completion.
993
+ */
994
+ getCompletion(name: string): Completion | undefined;
995
+ /**
996
+ * Get base completion by name.
997
+ *
998
+ * @param name Name of the completion.
999
+ */
1000
+ getBaseCompletion(name: string): Completion | undefined;
1001
+ /**
1002
+ * Get global completions by name.
1003
+ *
1004
+ * @param name Name of the completion.
1005
+ */
1006
+ getGlobalCompletion(name: string): Completion | undefined;
1007
+ /**
1008
+ * Checks whether the command has environment variables or not.
1009
+ *
1010
+ * @param hidden Include hidden environment variable.
1011
+ */
1012
+ hasEnvVars(hidden?: boolean): boolean;
1013
+ /**
1014
+ * Get environment variables.
1015
+ *
1016
+ * @param hidden Include hidden environment variable.
1017
+ */
1018
+ getEnvVars(hidden?: boolean): EnvVar[];
1019
+ /**
1020
+ * Get base environment variables.
1021
+ *
1022
+ * @param hidden Include hidden environment variable.
1023
+ */
1024
+ getBaseEnvVars(hidden?: boolean): EnvVar[];
1025
+ /**
1026
+ * Get global environment variables.
1027
+ *
1028
+ * @param hidden Include hidden environment variable.
1029
+ */
1030
+ getGlobalEnvVars(hidden?: boolean): EnvVar[];
1031
+ /**
1032
+ * Checks whether the command has an environment variable with given name or not.
1033
+ *
1034
+ * @param name Name of the environment variable.
1035
+ * @param hidden Include hidden environment variable.
1036
+ */
1037
+ hasEnvVar(name: string, hidden?: boolean): boolean;
1038
+ /**
1039
+ * Get environment variable by name.
1040
+ *
1041
+ * @param name Name of the environment variable.
1042
+ * @param hidden Include hidden environment variable.
1043
+ */
1044
+ getEnvVar(name: string, hidden?: boolean): EnvVar | undefined;
1045
+ /**
1046
+ * Get base environment variable by name.
1047
+ *
1048
+ * @param name Name of the environment variable.
1049
+ * @param hidden Include hidden environment variable.
1050
+ */
1051
+ getBaseEnvVar(name: string, hidden?: boolean): EnvVar | undefined;
1052
+ /**
1053
+ * Get global environment variable by name.
1054
+ *
1055
+ * @param name Name of the environment variable.
1056
+ * @param hidden Include hidden environment variable.
1057
+ */
1058
+ getGlobalEnvVar(name: string, hidden?: boolean): EnvVar | undefined;
1059
+ /** Checks whether the command has examples or not. */
1060
+ hasExamples(): boolean;
1061
+ /** Get all examples. */
1062
+ getExamples(): Example[];
1063
+ /** Checks whether the command has an example with given name or not. */
1064
+ hasExample(name: string): boolean;
1065
+ /** Get example with given name. */
1066
+ getExample(name: string): Example | undefined;
1067
+ private getHelpOption;
1068
+ private isAutoHelpEnabled;
1069
+ }
1070
+ interface DefaultOption {
1071
+ flags: string;
1072
+ desc?: string;
1073
+ opts?: OptionOptions;
1074
+ }
1075
+ interface ParseContext extends ParseFlagsContext<Record<string, unknown>> {
1076
+ actions: Array<ActionHandler>;
1077
+ env: Record<string, unknown>;
1078
+ }
1079
+ interface ParseOptionsOptions {
1080
+ stopEarly?: boolean;
1081
+ stopOnUnknown?: boolean;
1082
+ dotted?: boolean;
1083
+ args?: Array<ArgumentOptions>;
1084
+ }
1085
+ export {};
1086
+ //# sourceMappingURL=command.d.ts.map