bob-core 3.0.0-beta.4 → 3.0.0-beta.6

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 (183) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/{src/Cli.d.ts → Cli.d.ts} +20 -0
  3. package/dist/cjs/Command.d.ts +91 -0
  4. package/dist/cjs/CommandParser.d.ts +122 -0
  5. package/dist/cjs/{src/CommandRegistry.d.ts → CommandRegistry.d.ts} +12 -0
  6. package/dist/cjs/ExceptionHandler.d.ts +14 -0
  7. package/dist/cjs/HelpFlag.d.ts +27 -0
  8. package/dist/cjs/StringSimilarity.d.ts +31 -0
  9. package/dist/cjs/args/index.d.ts +131 -0
  10. package/dist/{esm/src → cjs}/errors/BadCommandArgument.d.ts +4 -2
  11. package/dist/cjs/{src/errors → errors}/BadCommandFlag.d.ts +4 -2
  12. package/dist/cjs/errors/BobError.d.ts +13 -0
  13. package/dist/cjs/errors/CommandNotFoundError.d.ts +9 -0
  14. package/dist/{esm/src → cjs}/errors/InvalidFlag.d.ts +4 -2
  15. package/dist/cjs/errors/MissingRequiredArgumentValue.d.ts +9 -0
  16. package/dist/cjs/errors/MissingRequiredFlagValue.d.ts +9 -0
  17. package/dist/cjs/errors/TooManyArguments.d.ts +10 -0
  18. package/dist/cjs/errors/ValidationError.d.ts +10 -0
  19. package/dist/{esm/src → cjs}/errors/renderError.d.ts +2 -2
  20. package/dist/cjs/flags/boolean.d.ts +20 -0
  21. package/dist/cjs/flags/custom.d.ts +12 -0
  22. package/dist/cjs/flags/directory.d.ts +27 -0
  23. package/dist/cjs/flags/file.d.ts +27 -0
  24. package/dist/cjs/flags/helpers.d.ts +9 -0
  25. package/dist/cjs/flags/index.d.ts +160 -0
  26. package/dist/cjs/flags/number.d.ts +32 -0
  27. package/dist/cjs/flags/option.d.ts +8 -0
  28. package/dist/cjs/flags/string.d.ts +19 -0
  29. package/dist/cjs/flags/url.d.ts +19 -0
  30. package/dist/cjs/index.js +10 -0
  31. package/dist/cjs/{src/lib → lib}/helpers.d.ts +1 -1
  32. package/dist/cjs/lib/types.d.ts +99 -0
  33. package/dist/cjs/shared/ask-helpers.d.ts +7 -0
  34. package/dist/cjs/shared/flagsUtils.d.ts +5 -0
  35. package/dist/cjs/ux/askForConfirmation.d.ts +10 -0
  36. package/dist/cjs/{src/ux → ux}/askForToggle.d.ts +5 -1
  37. package/dist/cjs/ux/helpers.d.ts +6 -0
  38. package/dist/{esm/src → cjs}/ux/index.d.ts +30 -2
  39. package/dist/esm/{src/Cli.d.ts → Cli.d.ts} +20 -0
  40. package/dist/esm/Command.d.ts +91 -0
  41. package/dist/esm/CommandParser.d.ts +122 -0
  42. package/dist/esm/{src/CommandRegistry.d.ts → CommandRegistry.d.ts} +12 -0
  43. package/dist/esm/ExceptionHandler.d.ts +14 -0
  44. package/dist/esm/HelpFlag.d.ts +27 -0
  45. package/dist/esm/StringSimilarity.d.ts +31 -0
  46. package/dist/esm/args/index.d.ts +131 -0
  47. package/dist/{cjs/src → esm}/errors/BadCommandArgument.d.ts +4 -2
  48. package/dist/esm/{src/errors → errors}/BadCommandFlag.d.ts +4 -2
  49. package/dist/esm/errors/BobError.d.ts +13 -0
  50. package/dist/esm/errors/CommandNotFoundError.d.ts +9 -0
  51. package/dist/{cjs/src → esm}/errors/InvalidFlag.d.ts +4 -2
  52. package/dist/esm/errors/MissingRequiredArgumentValue.d.ts +9 -0
  53. package/dist/esm/errors/MissingRequiredFlagValue.d.ts +9 -0
  54. package/dist/esm/errors/TooManyArguments.d.ts +10 -0
  55. package/dist/esm/errors/ValidationError.d.ts +10 -0
  56. package/dist/{cjs/src → esm}/errors/renderError.d.ts +2 -2
  57. package/dist/esm/flags/boolean.d.ts +20 -0
  58. package/dist/esm/flags/custom.d.ts +12 -0
  59. package/dist/esm/flags/directory.d.ts +27 -0
  60. package/dist/esm/flags/file.d.ts +27 -0
  61. package/dist/esm/flags/helpers.d.ts +9 -0
  62. package/dist/esm/flags/index.d.ts +160 -0
  63. package/dist/esm/flags/number.d.ts +32 -0
  64. package/dist/esm/flags/option.d.ts +8 -0
  65. package/dist/esm/flags/string.d.ts +19 -0
  66. package/dist/esm/flags/url.d.ts +19 -0
  67. package/dist/esm/{src/index.js → index.js} +346 -267
  68. package/dist/esm/{src/lib → lib}/helpers.d.ts +1 -1
  69. package/dist/esm/lib/types.d.ts +99 -0
  70. package/dist/esm/shared/ask-helpers.d.ts +7 -0
  71. package/dist/esm/shared/flagsUtils.d.ts +5 -0
  72. package/dist/esm/ux/askForConfirmation.d.ts +10 -0
  73. package/dist/esm/{src/ux → ux}/askForToggle.d.ts +5 -1
  74. package/dist/esm/ux/helpers.d.ts +6 -0
  75. package/dist/{cjs/src → esm}/ux/index.d.ts +30 -2
  76. package/package.json +1 -1
  77. package/dist/cjs/package-BYPkkzPN.cjs +0 -1
  78. package/dist/cjs/src/Command.d.ts +0 -48
  79. package/dist/cjs/src/CommandParser.d.ts +0 -110
  80. package/dist/cjs/src/ExceptionHandler.d.ts +0 -6
  81. package/dist/cjs/src/HelpFlag.d.ts +0 -12
  82. package/dist/cjs/src/StringSimilarity.d.ts +0 -26
  83. package/dist/cjs/src/args/index.d.ts +0 -67
  84. package/dist/cjs/src/errors/BobError.d.ts +0 -5
  85. package/dist/cjs/src/errors/CommandNotFoundError.d.ts +0 -7
  86. package/dist/cjs/src/errors/MissingRequiredArgumentValue.d.ts +0 -7
  87. package/dist/cjs/src/errors/MissingRequiredFlagValue.d.ts +0 -7
  88. package/dist/cjs/src/errors/TooManyArguments.d.ts +0 -8
  89. package/dist/cjs/src/errors/ValidationError.d.ts +0 -3
  90. package/dist/cjs/src/flags/boolean.d.ts +0 -9
  91. package/dist/cjs/src/flags/custom.d.ts +0 -9
  92. package/dist/cjs/src/flags/directory.d.ts +0 -14
  93. package/dist/cjs/src/flags/file.d.ts +0 -14
  94. package/dist/cjs/src/flags/helpers.d.ts +0 -3
  95. package/dist/cjs/src/flags/index.d.ts +0 -76
  96. package/dist/cjs/src/flags/number.d.ts +0 -17
  97. package/dist/cjs/src/flags/option.d.ts +0 -6
  98. package/dist/cjs/src/flags/string.d.ts +0 -8
  99. package/dist/cjs/src/flags/url.d.ts +0 -8
  100. package/dist/cjs/src/index.js +0 -10
  101. package/dist/cjs/src/lib/types.d.ts +0 -59
  102. package/dist/cjs/src/shared/ask-helpers.d.ts +0 -7
  103. package/dist/cjs/src/ux/askForConfirmation.d.ts +0 -5
  104. package/dist/cjs/src/ux/helpers.d.ts +0 -1
  105. package/dist/esm/package-LkysKcR6.js +0 -60
  106. package/dist/esm/src/Command.d.ts +0 -48
  107. package/dist/esm/src/CommandParser.d.ts +0 -110
  108. package/dist/esm/src/ExceptionHandler.d.ts +0 -6
  109. package/dist/esm/src/HelpFlag.d.ts +0 -12
  110. package/dist/esm/src/StringSimilarity.d.ts +0 -26
  111. package/dist/esm/src/args/index.d.ts +0 -67
  112. package/dist/esm/src/errors/BobError.d.ts +0 -5
  113. package/dist/esm/src/errors/CommandNotFoundError.d.ts +0 -7
  114. package/dist/esm/src/errors/MissingRequiredArgumentValue.d.ts +0 -7
  115. package/dist/esm/src/errors/MissingRequiredFlagValue.d.ts +0 -7
  116. package/dist/esm/src/errors/TooManyArguments.d.ts +0 -8
  117. package/dist/esm/src/errors/ValidationError.d.ts +0 -3
  118. package/dist/esm/src/flags/boolean.d.ts +0 -9
  119. package/dist/esm/src/flags/custom.d.ts +0 -9
  120. package/dist/esm/src/flags/directory.d.ts +0 -14
  121. package/dist/esm/src/flags/file.d.ts +0 -14
  122. package/dist/esm/src/flags/helpers.d.ts +0 -3
  123. package/dist/esm/src/flags/index.d.ts +0 -76
  124. package/dist/esm/src/flags/number.d.ts +0 -17
  125. package/dist/esm/src/flags/option.d.ts +0 -6
  126. package/dist/esm/src/flags/string.d.ts +0 -8
  127. package/dist/esm/src/flags/url.d.ts +0 -8
  128. package/dist/esm/src/lib/types.d.ts +0 -59
  129. package/dist/esm/src/shared/ask-helpers.d.ts +0 -7
  130. package/dist/esm/src/ux/askForConfirmation.d.ts +0 -5
  131. package/dist/esm/src/ux/helpers.d.ts +0 -1
  132. /package/dist/cjs/{src/CommandSignatureParser.d.ts → CommandSignatureParser.d.ts} +0 -0
  133. /package/dist/cjs/{src/CommandWithSignature.d.ts → CommandWithSignature.d.ts} +0 -0
  134. /package/dist/cjs/{src/Logger.d.ts → Logger.d.ts} +0 -0
  135. /package/dist/cjs/{src/commands → commands}/HelpCommand.d.ts +0 -0
  136. /package/dist/cjs/{src/contracts → contracts}/LoggerContract.d.ts +0 -0
  137. /package/dist/cjs/{src/contracts → contracts}/index.d.ts +0 -0
  138. /package/dist/cjs/{src/errors → errors}/index.d.ts +0 -0
  139. /package/dist/cjs/{src/index.d.ts → index.d.ts} +0 -0
  140. /package/dist/cjs/{src/lib → lib}/string.d.ts +0 -0
  141. /package/dist/cjs/{src/shared → shared}/parsers.d.ts +0 -0
  142. /package/dist/cjs/{src/ux → ux}/askForCheckbox.d.ts +0 -0
  143. /package/dist/cjs/{src/ux → ux}/askForEditor.d.ts +0 -0
  144. /package/dist/cjs/{src/ux → ux}/askForExpand.d.ts +0 -0
  145. /package/dist/cjs/{src/ux → ux}/askForFileSelector.d.ts +0 -0
  146. /package/dist/cjs/{src/ux → ux}/askForInput.d.ts +0 -0
  147. /package/dist/cjs/{src/ux → ux}/askForList.d.ts +0 -0
  148. /package/dist/cjs/{src/ux → ux}/askForNumber.d.ts +0 -0
  149. /package/dist/cjs/{src/ux → ux}/askForPassword.d.ts +0 -0
  150. /package/dist/cjs/{src/ux → ux}/askForRawList.d.ts +0 -0
  151. /package/dist/cjs/{src/ux → ux}/askForSearch.d.ts +0 -0
  152. /package/dist/cjs/{src/ux → ux}/askForSelect.d.ts +0 -0
  153. /package/dist/cjs/{src/ux → ux}/keyValue.d.ts +0 -0
  154. /package/dist/cjs/{src/ux → ux}/loader.d.ts +0 -0
  155. /package/dist/cjs/{src/ux → ux}/progressBar.d.ts +0 -0
  156. /package/dist/cjs/{src/ux → ux}/table.d.ts +0 -0
  157. /package/dist/cjs/{src/ux → ux}/types.d.ts +0 -0
  158. /package/dist/esm/{src/CommandSignatureParser.d.ts → CommandSignatureParser.d.ts} +0 -0
  159. /package/dist/esm/{src/CommandWithSignature.d.ts → CommandWithSignature.d.ts} +0 -0
  160. /package/dist/esm/{src/Logger.d.ts → Logger.d.ts} +0 -0
  161. /package/dist/esm/{src/commands → commands}/HelpCommand.d.ts +0 -0
  162. /package/dist/esm/{src/contracts → contracts}/LoggerContract.d.ts +0 -0
  163. /package/dist/esm/{src/contracts → contracts}/index.d.ts +0 -0
  164. /package/dist/esm/{src/errors → errors}/index.d.ts +0 -0
  165. /package/dist/esm/{src/index.d.ts → index.d.ts} +0 -0
  166. /package/dist/esm/{src/lib → lib}/string.d.ts +0 -0
  167. /package/dist/esm/{src/shared → shared}/parsers.d.ts +0 -0
  168. /package/dist/esm/{src/ux → ux}/askForCheckbox.d.ts +0 -0
  169. /package/dist/esm/{src/ux → ux}/askForEditor.d.ts +0 -0
  170. /package/dist/esm/{src/ux → ux}/askForExpand.d.ts +0 -0
  171. /package/dist/esm/{src/ux → ux}/askForFileSelector.d.ts +0 -0
  172. /package/dist/esm/{src/ux → ux}/askForInput.d.ts +0 -0
  173. /package/dist/esm/{src/ux → ux}/askForList.d.ts +0 -0
  174. /package/dist/esm/{src/ux → ux}/askForNumber.d.ts +0 -0
  175. /package/dist/esm/{src/ux → ux}/askForPassword.d.ts +0 -0
  176. /package/dist/esm/{src/ux → ux}/askForRawList.d.ts +0 -0
  177. /package/dist/esm/{src/ux → ux}/askForSearch.d.ts +0 -0
  178. /package/dist/esm/{src/ux → ux}/askForSelect.d.ts +0 -0
  179. /package/dist/esm/{src/ux → ux}/keyValue.d.ts +0 -0
  180. /package/dist/esm/{src/ux → ux}/loader.d.ts +0 -0
  181. /package/dist/esm/{src/ux → ux}/progressBar.d.ts +0 -0
  182. /package/dist/esm/{src/ux → ux}/table.d.ts +0 -0
  183. /package/dist/esm/{src/ux → ux}/types.d.ts +0 -0
@@ -1,8 +0,0 @@
1
- import { Logger } from '../Logger.js';
2
- import { BobError } from './BobError.js';
3
- export declare class TooManyArguments extends BobError {
4
- readonly expected: number;
5
- readonly received: number;
6
- constructor(expected: number, received: number);
7
- pretty(logger: Logger): void;
8
- }
@@ -1,3 +0,0 @@
1
- export declare class ValidationError extends Error {
2
- constructor(message: string);
3
- }
@@ -1,9 +0,0 @@
1
- import { ParameterOpts } from '../lib/types.js';
2
- export declare const booleanFlag: {
3
- (): import('../lib/types.js').FlagProps<boolean> & import('../lib/types.js').CustomOptions & {
4
- parse(input: any, opts: ParameterOpts): boolean;
5
- };
6
- <const U extends import('../lib/types.js').FlagProps<boolean> & Partial<import('../lib/types.js').CustomOptions>>(overrides: U & Record<Exclude<keyof U, string>, never>): import('../lib/types.js').FlagProps<boolean> & import('../lib/types.js').CustomOptions & U & {
7
- parse(input: any, opts: ParameterOpts): boolean;
8
- };
9
- };
@@ -1,9 +0,0 @@
1
- import { CustomOptions, FlagProps, ParameterOpts } from '../lib/types.js';
2
- export declare function custom<T, P extends CustomOptions = CustomOptions>(defaults?: FlagProps<T> & Partial<P>): {
3
- (): FlagProps<T> & P & {
4
- parse(input: any, opts: ParameterOpts): T;
5
- };
6
- <const U extends FlagProps<T> & Partial<P>>(overrides: U & Record<Exclude<keyof U, keyof FlagProps<T> | keyof P>, never>): FlagProps<T> & P & U & {
7
- parse(input: any, opts: ParameterOpts): T;
8
- };
9
- };
@@ -1,14 +0,0 @@
1
- export declare const directoryFlag: {
2
- (): import('../index.js').FlagProps<string> & {
3
- exists?: boolean;
4
- } & {
5
- parse(input: any, opts: import('../index.js').ParameterOpts): string;
6
- };
7
- <const U extends import('../index.js').FlagProps<string> & Partial<{
8
- exists?: boolean;
9
- }>>(overrides: U & Record<Exclude<keyof U, keyof import('../index.js').FlagProps<T> | "exists">, never>): import('../index.js').FlagProps<string> & {
10
- exists?: boolean;
11
- } & U & {
12
- parse(input: any, opts: import('../index.js').ParameterOpts): string;
13
- };
14
- };
@@ -1,14 +0,0 @@
1
- export declare const fileFlag: {
2
- (): import('../index.js').FlagProps<string> & {
3
- exists?: boolean;
4
- } & {
5
- parse(input: any, opts: import('../index.js').ParameterOpts): string;
6
- };
7
- <const U extends import('../index.js').FlagProps<string> & Partial<{
8
- exists?: boolean;
9
- }>>(overrides: U & Record<Exclude<keyof U, keyof import('../index.js').FlagProps<T> | "exists">, never>): import('../index.js').FlagProps<string> & {
10
- exists?: boolean;
11
- } & U & {
12
- parse(input: any, opts: import('../index.js').ParameterOpts): string;
13
- };
14
- };
@@ -1,3 +0,0 @@
1
- import { FlagDefinition } from '../lib/types.js';
2
- export declare function formatPromptMessage(name: string, definition: FlagDefinition): string;
3
- export declare function normalizeAliases(alias: string | readonly string[] | undefined): readonly string[];
@@ -1,76 +0,0 @@
1
- import { custom } from './custom.js';
2
- import { optionFlag } from './option.js';
3
- export declare const Flags: {
4
- string: {
5
- (): import('../index.js').FlagProps<string> & import('../index.js').CustomOptions & {
6
- parse(input: any, opts: import('../index.js').ParameterOpts): string;
7
- };
8
- <const U extends import('../index.js').FlagProps<string> & Partial<import('../index.js').CustomOptions>>(overrides: U & Record<Exclude<keyof U, string>, never>): import('../index.js').FlagProps<string> & import('../index.js').CustomOptions & U & {
9
- parse(input: any, opts: import('../index.js').ParameterOpts): string;
10
- };
11
- };
12
- number: {
13
- (): import('../index.js').FlagProps<number> & {
14
- min?: number;
15
- max?: number;
16
- } & {
17
- parse(input: any, opts: import('../index.js').ParameterOpts): number;
18
- };
19
- <const U extends import('../index.js').FlagProps<number> & Partial<{
20
- min?: number;
21
- max?: number;
22
- }>>(overrides: U & Record<Exclude<keyof U, keyof import('../index.js').FlagProps<T> | "min" | "max">, never>): import('../index.js').FlagProps<number> & {
23
- min?: number;
24
- max?: number;
25
- } & U & {
26
- parse(input: any, opts: import('../index.js').ParameterOpts): number;
27
- };
28
- };
29
- boolean: {
30
- (): import('../index.js').FlagProps<boolean> & import('../index.js').CustomOptions & {
31
- parse(input: any, opts: import('../index.js').ParameterOpts): boolean;
32
- };
33
- <const U extends import('../index.js').FlagProps<boolean> & Partial<import('../index.js').CustomOptions>>(overrides: U & Record<Exclude<keyof U, string>, never>): import('../index.js').FlagProps<boolean> & import('../index.js').CustomOptions & U & {
34
- parse(input: any, opts: import('../index.js').ParameterOpts): boolean;
35
- };
36
- };
37
- option: typeof optionFlag;
38
- file: {
39
- (): import('../index.js').FlagProps<string> & {
40
- exists?: boolean;
41
- } & {
42
- parse(input: any, opts: import('../index.js').ParameterOpts): string;
43
- };
44
- <const U extends import('../index.js').FlagProps<string> & Partial<{
45
- exists?: boolean;
46
- }>>(overrides: U & Record<Exclude<keyof U, keyof import('../index.js').FlagProps<T> | "exists">, never>): import('../index.js').FlagProps<string> & {
47
- exists?: boolean;
48
- } & U & {
49
- parse(input: any, opts: import('../index.js').ParameterOpts): string;
50
- };
51
- };
52
- directory: {
53
- (): import('../index.js').FlagProps<string> & {
54
- exists?: boolean;
55
- } & {
56
- parse(input: any, opts: import('../index.js').ParameterOpts): string;
57
- };
58
- <const U extends import('../index.js').FlagProps<string> & Partial<{
59
- exists?: boolean;
60
- }>>(overrides: U & Record<Exclude<keyof U, keyof import('../index.js').FlagProps<T> | "exists">, never>): import('../index.js').FlagProps<string> & {
61
- exists?: boolean;
62
- } & U & {
63
- parse(input: any, opts: import('../index.js').ParameterOpts): string;
64
- };
65
- };
66
- url: {
67
- (): import('../index.js').FlagProps<URL> & import('../index.js').CustomOptions & {
68
- parse(input: any, opts: import('../index.js').ParameterOpts): URL;
69
- };
70
- <const U extends import('../index.js').FlagProps<URL> & Partial<import('../index.js').CustomOptions>>(overrides: U & Record<Exclude<keyof U, string>, never>): import('../index.js').FlagProps<URL> & import('../index.js').CustomOptions & U & {
71
- parse(input: any, opts: import('../index.js').ParameterOpts): URL;
72
- };
73
- };
74
- custom: typeof custom;
75
- };
76
- export { Args } from '../args/index.js';
@@ -1,17 +0,0 @@
1
- export declare const numberFlag: {
2
- (): import('../index.js').FlagProps<number> & {
3
- min?: number;
4
- max?: number;
5
- } & {
6
- parse(input: any, opts: import('../index.js').ParameterOpts): number;
7
- };
8
- <const U extends import('../index.js').FlagProps<number> & Partial<{
9
- min?: number;
10
- max?: number;
11
- }>>(overrides: U & Record<Exclude<keyof U, keyof import('../index.js').FlagProps<T> | "min" | "max">, never>): import('../index.js').FlagProps<number> & {
12
- min?: number;
13
- max?: number;
14
- } & U & {
15
- parse(input: any, opts: import('../index.js').ParameterOpts): number;
16
- };
17
- };
@@ -1,6 +0,0 @@
1
- import { FlagProps, ParameterOpts } from '../lib/types.js';
2
- export declare function optionFlag<const T extends readonly string[], const U extends Partial<FlagProps>>(opts: {
3
- options: T;
4
- } & U): U & FlagProps<T[number]> & {
5
- parse(input: any, opts: ParameterOpts): T[number];
6
- };
@@ -1,8 +0,0 @@
1
- export declare const stringFlag: {
2
- (): import('../index.js').FlagProps<string> & import('../index.js').CustomOptions & {
3
- parse(input: any, opts: import('../index.js').ParameterOpts): string;
4
- };
5
- <const U extends import('../index.js').FlagProps<string> & Partial<import('../index.js').CustomOptions>>(overrides: U & Record<Exclude<keyof U, string>, never>): import('../index.js').FlagProps<string> & import('../index.js').CustomOptions & U & {
6
- parse(input: any, opts: import('../index.js').ParameterOpts): string;
7
- };
8
- };
@@ -1,8 +0,0 @@
1
- export declare const urlFlag: {
2
- (): import('../index.js').FlagProps<URL> & import('../index.js').CustomOptions & {
3
- parse(input: any, opts: import('../index.js').ParameterOpts): URL;
4
- };
5
- <const U extends import('../index.js').FlagProps<URL> & Partial<import('../index.js').CustomOptions>>(overrides: U & Record<Exclude<keyof U, string>, never>): import('../index.js').FlagProps<URL> & import('../index.js').CustomOptions & U & {
6
- parse(input: any, opts: import('../index.js').ParameterOpts): URL;
7
- };
8
- };
@@ -1,59 +0,0 @@
1
- import { Command } from '../Command.js';
2
- import { UX } from '../ux/index.js';
3
- export type ContextDefinition = any;
4
- export type CustomOptions = Record<string, unknown>;
5
- export type ParameterOpts<C extends ContextDefinition = ContextDefinition> = {
6
- name: string;
7
- ux: UX;
8
- ctx: C;
9
- definition: FlagDefinition & Record<string, any>;
10
- cmd: typeof Command;
11
- };
12
- export type FlagProps<T = any> = {
13
- type?: 'string' | 'number' | 'boolean' | 'option' | 'file' | 'directory' | 'url' | 'custom';
14
- parse?: (input: any, opts: ParameterOpts) => T;
15
- ask?: (opts: ParameterOpts) => Promise<any>;
16
- description?: string;
17
- required?: boolean;
18
- default?: T | T[] | null | (() => Promise<T | T[] | null>);
19
- multiple?: boolean;
20
- help?: string;
21
- alias?: string | readonly string[];
22
- handler?: (value: T, opts: ParameterOpts) => {
23
- shouldStop: boolean;
24
- } | void;
25
- };
26
- export type FlagDefinition = FlagProps & {
27
- parse(input: any, opts: ParameterOpts): any;
28
- };
29
- export type FlagType<O> = O extends {
30
- parse: (...args: any[]) => infer R;
31
- } ? O extends {
32
- multiple: true;
33
- } ? [R] extends [Array<unknown>] ? R : R[] : R : never;
34
- type IsGuaranteed<O> = O extends {
35
- required: true;
36
- } ? true : O extends {
37
- multiple: true;
38
- } ? true : O extends {
39
- default: infer D;
40
- } ? undefined extends D ? false : null extends D ? false : true : false;
41
- export type FlagReturnType<O> = IsGuaranteed<O> extends true ? FlagType<O> : FlagType<O> | null;
42
- export type FlagsSchema = {
43
- [key: string]: FlagDefinition;
44
- };
45
- export type FlagsObject<Options extends FlagsSchema> = {
46
- [Key in keyof Options]: FlagReturnType<Options[Key]>;
47
- };
48
- export type ArgsSchema = FlagsSchema;
49
- export type InferFlags<T> = T extends {
50
- flags: infer O extends FlagsSchema;
51
- } ? O : FlagsSchema;
52
- export type InferArgs<T> = T extends {
53
- args: infer A extends ArgsSchema;
54
- } ? A : ArgsSchema;
55
- export type Parsed<T> = {
56
- flags: FlagsObject<InferFlags<T>>;
57
- args: FlagsObject<InferArgs<T>>;
58
- };
59
- export {};
@@ -1,7 +0,0 @@
1
- import { ParameterOpts } from '../lib/types.js';
2
- export declare function buildStringAsk(builderOpts: ParameterOpts): Promise<any>;
3
- export declare function buildNumberAsk(builderOpts: ParameterOpts): Promise<any>;
4
- export declare function buildOptionAsk(builderOpts: ParameterOpts): Promise<any>;
5
- export declare function buildFileAsk(builderOpts: ParameterOpts): Promise<any>;
6
- export declare function buildDirectoryAsk(builderOpts: ParameterOpts): Promise<any>;
7
- export declare function buildUrlAsk(builderOpts: ParameterOpts): Promise<any>;
@@ -1,5 +0,0 @@
1
- export type AskForConfirmationOptions = {
2
- default?: boolean;
3
- transformer?: (value: boolean) => string;
4
- };
5
- export declare function askForConfirmation(message?: string, opts?: AskForConfirmationOptions): Promise<boolean>;
@@ -1 +0,0 @@
1
- export declare function withCancelHandling<T>(fn: () => Promise<T>, fallback: T): Promise<T>;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes