@reliverse/rempts 1.7.65 → 2.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +1534 -1431
  3. package/cleanup.mjs +33 -0
  4. package/dist/cancel.d.ts +31 -0
  5. package/dist/cancel.js +28 -0
  6. package/dist/ffi.d.ts +1 -0
  7. package/dist/ffi.js +165 -0
  8. package/dist/group.d.ts +16 -0
  9. package/dist/group.js +22 -0
  10. package/dist/launcher/command.d.ts +8 -0
  11. package/dist/launcher/command.js +10 -0
  12. package/dist/launcher/discovery.d.ts +3 -0
  13. package/dist/launcher/discovery.js +207 -0
  14. package/dist/launcher/errors.d.ts +15 -0
  15. package/dist/launcher/errors.js +31 -0
  16. package/dist/launcher/help.d.ts +3 -0
  17. package/dist/launcher/help.js +145 -0
  18. package/dist/launcher/mod.d.ts +12 -0
  19. package/dist/launcher/mod.js +222 -0
  20. package/dist/launcher/parser.d.ts +14 -0
  21. package/dist/launcher/parser.js +255 -0
  22. package/dist/launcher/registry.d.ts +10 -0
  23. package/dist/launcher/registry.js +42 -0
  24. package/dist/launcher/types.d.ts +78 -0
  25. package/dist/launcher/validator.d.ts +3 -0
  26. package/dist/launcher/validator.js +39 -0
  27. package/dist/mod.d.ts +6 -0
  28. package/dist/mod.js +6 -0
  29. package/dist/prompt.d.ts +13 -0
  30. package/dist/prompt.js +53 -0
  31. package/dist/selection.d.ts +92 -0
  32. package/dist/selection.js +191 -0
  33. package/dist/spinner.d.ts +26 -0
  34. package/dist/spinner.js +141 -0
  35. package/dist/utils.d.ts +3 -0
  36. package/dist/utils.js +11 -0
  37. package/package.json +41 -47
  38. package/bin/libs/animate/animate-mod.ts.txt +0 -78
  39. package/bin/libs/anykey/anykey-mod.d.ts +0 -12
  40. package/bin/libs/anykey/anykey-mod.js +0 -125
  41. package/bin/libs/cancel/cancel.d.ts +0 -45
  42. package/bin/libs/cancel/cancel.js +0 -72
  43. package/bin/libs/confirm/confirm-alias.d.ts +0 -2
  44. package/bin/libs/confirm/confirm-alias.js +0 -2
  45. package/bin/libs/confirm/confirm-mod.d.ts +0 -5
  46. package/bin/libs/confirm/confirm-mod.js +0 -179
  47. package/bin/libs/date/date.d.ts +0 -2
  48. package/bin/libs/date/date.js +0 -254
  49. package/bin/libs/editor/editor-mod.d.ts +0 -25
  50. package/bin/libs/editor/editor-mod.js +0 -1133
  51. package/bin/libs/figures/figures-mod.d.ts +0 -461
  52. package/bin/libs/figures/figures-mod.js +0 -285
  53. package/bin/libs/group/group-mod.d.ts +0 -33
  54. package/bin/libs/group/group-mod.js +0 -89
  55. package/bin/libs/input/input-alias.d.ts +0 -5
  56. package/bin/libs/input/input-alias.js +0 -4
  57. package/bin/libs/input/input-mod.d.ts +0 -16
  58. package/bin/libs/input/input-mod.js +0 -370
  59. package/bin/libs/intro/intro-alias.d.ts +0 -3
  60. package/bin/libs/intro/intro-alias.js +0 -3
  61. package/bin/libs/intro/intro-mod.d.ts +0 -19
  62. package/bin/libs/intro/intro-mod.js +0 -71
  63. package/bin/libs/launcher/command-runner.d.ts +0 -31
  64. package/bin/libs/launcher/command-runner.js +0 -229
  65. package/bin/libs/launcher/launcher-alias.d.ts +0 -2
  66. package/bin/libs/launcher/launcher-alias.js +0 -2
  67. package/bin/libs/launcher/launcher-mod.d.ts +0 -66
  68. package/bin/libs/launcher/launcher-mod.js +0 -1037
  69. package/bin/libs/launcher/launcher-types.d.ts +0 -176
  70. package/bin/libs/launcher/launcher-types.js +0 -0
  71. package/bin/libs/log/log-alias.d.ts +0 -1
  72. package/bin/libs/log/log-alias.js +0 -2
  73. package/bin/libs/msg-fmt/colors.d.ts +0 -30
  74. package/bin/libs/msg-fmt/colors.js +0 -42
  75. package/bin/libs/msg-fmt/mapping.d.ts +0 -3
  76. package/bin/libs/msg-fmt/mapping.js +0 -41
  77. package/bin/libs/msg-fmt/messages.d.ts +0 -35
  78. package/bin/libs/msg-fmt/messages.js +0 -305
  79. package/bin/libs/msg-fmt/terminal.d.ts +0 -15
  80. package/bin/libs/msg-fmt/terminal.js +0 -60
  81. package/bin/libs/msg-fmt/variants.d.ts +0 -11
  82. package/bin/libs/msg-fmt/variants.js +0 -52
  83. package/bin/libs/multiselect/multiselect-alias.d.ts +0 -2
  84. package/bin/libs/multiselect/multiselect-alias.js +0 -2
  85. package/bin/libs/multiselect/multiselect-prompt.d.ts +0 -2
  86. package/bin/libs/multiselect/multiselect-prompt.js +0 -340
  87. package/bin/libs/next-steps/next-steps.d.ts +0 -13
  88. package/bin/libs/next-steps/next-steps.js +0 -24
  89. package/bin/libs/number/number-mod.d.ts +0 -28
  90. package/bin/libs/number/number-mod.js +0 -234
  91. package/bin/libs/outro/outro-alias.d.ts +0 -3
  92. package/bin/libs/outro/outro-alias.js +0 -3
  93. package/bin/libs/outro/outro-mod.d.ts +0 -7
  94. package/bin/libs/outro/outro-mod.js +0 -49
  95. package/bin/libs/reliarg/reliarg-mod.d.ts +0 -76
  96. package/bin/libs/reliarg/reliarg-mod.js +0 -276
  97. package/bin/libs/results/results.d.ts +0 -7
  98. package/bin/libs/results/results.js +0 -27
  99. package/bin/libs/select/nummultiselect-prompt.d.ts +0 -6
  100. package/bin/libs/select/nummultiselect-prompt.js +0 -141
  101. package/bin/libs/select/numselect-prompt.d.ts +0 -7
  102. package/bin/libs/select/numselect-prompt.js +0 -111
  103. package/bin/libs/select/select-alias.d.ts +0 -9
  104. package/bin/libs/select/select-alias.js +0 -9
  105. package/bin/libs/select/select-prompt.d.ts +0 -5
  106. package/bin/libs/select/select-prompt.js +0 -311
  107. package/bin/libs/select/toggle-prompt.d.ts +0 -5
  108. package/bin/libs/select/toggle-prompt.js +0 -207
  109. package/bin/libs/spinner/spinner-impl.d.ts +0 -70
  110. package/bin/libs/spinner/spinner-impl.js +0 -336
  111. package/bin/libs/spinner/spinner-mod.d.ts +0 -167
  112. package/bin/libs/spinner/spinner-mod.js +0 -447
  113. package/bin/libs/utils/colorize.d.ts +0 -2
  114. package/bin/libs/utils/colorize.js +0 -122
  115. package/bin/libs/utils/errors.d.ts +0 -1
  116. package/bin/libs/utils/errors.js +0 -17
  117. package/bin/libs/utils/prevent.d.ts +0 -8
  118. package/bin/libs/utils/prevent.js +0 -62
  119. package/bin/libs/utils/prompt-end.d.ts +0 -8
  120. package/bin/libs/utils/prompt-end.js +0 -36
  121. package/bin/libs/utils/stream-text.d.ts +0 -18
  122. package/bin/libs/utils/stream-text.js +0 -138
  123. package/bin/libs/utils/system.d.ts +0 -6
  124. package/bin/libs/utils/system.js +0 -7
  125. package/bin/libs/utils/validate.d.ts +0 -21
  126. package/bin/libs/utils/validate.js +0 -17
  127. package/bin/libs/visual/visual-mod.ts.txt +0 -19
  128. package/bin/mod.d.ts +0 -50
  129. package/bin/mod.js +0 -127
  130. package/bin/types.d.ts +0 -372
  131. /package/{bin → dist/launcher}/types.js +0 -0
@@ -1,370 +0,0 @@
1
- import readline from "node:readline/promises";
2
- import { re } from "@reliverse/relico";
3
- import { isUnicodeSupported } from "@reliverse/reltime";
4
- import { bar, msg, msgUndoAll } from "../msg-fmt/messages.js";
5
- import { deleteLastLine } from "../msg-fmt/terminal.js";
6
- import { completePrompt } from "../utils/prompt-end.js";
7
- import { streamText } from "../utils/stream-text.js";
8
- const unicode = isUnicodeSupported();
9
- const S_MASK = unicode ? "\u258B" : "*";
10
- function getMaskChar(customMask) {
11
- if (!unicode) return "*";
12
- return customMask ?? S_MASK;
13
- }
14
- async function ask(prompt, mode, mask) {
15
- return new Promise((resolve) => {
16
- let buffer = "";
17
- const maskChar = getMaskChar(mask);
18
- process.stdout.write(prompt);
19
- const onData = (data) => {
20
- const str = data.toString("utf-8");
21
- for (const char of str) {
22
- if (char === "\n" || char === "\r") {
23
- process.stdout.write("\n");
24
- cleanup();
25
- resolve(buffer);
26
- return;
27
- }
28
- if (char === "") {
29
- cleanup();
30
- resolve(null);
31
- return;
32
- }
33
- if (char === "\x7F" || char === "\b") {
34
- if (buffer.length > 0) {
35
- buffer = buffer.slice(0, -1);
36
- }
37
- redrawPrompt(buffer, prompt);
38
- continue;
39
- }
40
- buffer += char;
41
- redrawPrompt(buffer, prompt);
42
- }
43
- };
44
- process.stdin.on("data", onData);
45
- const cleanup = () => {
46
- process.stdin.removeListener("data", onData);
47
- };
48
- const redrawPrompt = (inputBuffer, textPrompt) => {
49
- process.stdout.clearLine(0);
50
- process.stdout.cursorTo(0);
51
- const displayText = mode === "password" ? maskChar.repeat(inputBuffer.length) : inputBuffer;
52
- process.stdout.write(textPrompt + displayText);
53
- };
54
- });
55
- }
56
- function renderPromptUI(params) {
57
- const {
58
- title,
59
- hint = "",
60
- hintPlaceholderColor = "blue",
61
- content = "",
62
- contentColor = "dim",
63
- contentTypography = "italic",
64
- contentVariant = "none",
65
- titleColor = "cyan",
66
- titleTypography = "none",
67
- titleVariant = "none",
68
- borderColor = "dim",
69
- placeholder = "",
70
- userInput,
71
- errorMessage,
72
- symbol = "step_active",
73
- customSymbol = "",
74
- symbolColor = "cyan",
75
- shouldStream = false,
76
- streamDelay = 30
77
- } = params;
78
- const type = errorMessage !== "" ? "M_ERROR" : "M_GENERAL";
79
- if (shouldStream) {
80
- return new Promise((resolve) => {
81
- msg({
82
- type,
83
- title: "",
84
- titleColor,
85
- titleTypography,
86
- titleVariant,
87
- content: "",
88
- contentColor,
89
- contentTypography,
90
- contentVariant,
91
- borderColor,
92
- hint,
93
- hintPlaceholderColor,
94
- placeholder: userInput === "" ? placeholder : "",
95
- errorMessage,
96
- symbol,
97
- customSymbol,
98
- symbolColor
99
- });
100
- void streamText({
101
- text: title || "",
102
- delay: streamDelay,
103
- color: titleColor,
104
- newline: false
105
- }).then(async () => {
106
- msgUndoAll();
107
- msg({
108
- type,
109
- ...title !== void 0 && { title },
110
- titleColor,
111
- titleTypography,
112
- titleVariant,
113
- content: "",
114
- contentColor,
115
- contentTypography,
116
- contentVariant,
117
- borderColor,
118
- hint,
119
- hintPlaceholderColor,
120
- placeholder: userInput === "" ? placeholder : "",
121
- errorMessage,
122
- symbol,
123
- customSymbol,
124
- symbolColor
125
- });
126
- if (content) {
127
- await streamText({
128
- text: content,
129
- delay: streamDelay,
130
- color: contentColor,
131
- newline: false
132
- });
133
- }
134
- msgUndoAll();
135
- deleteLastLine();
136
- msg({
137
- type,
138
- ...title !== void 0 && { title },
139
- titleColor,
140
- titleTypography,
141
- titleVariant,
142
- content,
143
- contentColor,
144
- contentTypography,
145
- contentVariant,
146
- borderColor,
147
- hint,
148
- hintPlaceholderColor,
149
- placeholder: userInput === "" ? placeholder : "",
150
- errorMessage,
151
- symbol,
152
- customSymbol,
153
- symbolColor
154
- });
155
- resolve();
156
- });
157
- });
158
- }
159
- msg({
160
- type,
161
- ...title !== void 0 && { title },
162
- titleColor,
163
- titleTypography,
164
- titleVariant,
165
- content,
166
- contentColor,
167
- contentTypography,
168
- contentVariant,
169
- borderColor,
170
- hint,
171
- hintPlaceholderColor,
172
- placeholder: userInput === "" ? placeholder : "",
173
- errorMessage,
174
- symbol,
175
- customSymbol,
176
- symbolColor
177
- });
178
- if (userInput !== "") {
179
- msg({ type: "M_MIDDLE", title: ` ${userInput}` });
180
- }
181
- return Promise.resolve();
182
- }
183
- async function validateInput(input, validate) {
184
- let isValid = true;
185
- let errorMessage = "";
186
- if (validate && isValid) {
187
- const validationResult = await validate(input);
188
- if (typeof validationResult === "string") {
189
- isValid = false;
190
- errorMessage = validationResult;
191
- } else if (validationResult === false) {
192
- isValid = false;
193
- errorMessage = "Invalid input.";
194
- }
195
- }
196
- return { isValid, errorMessage };
197
- }
198
- export async function inputPrompt(options) {
199
- const {
200
- title,
201
- message,
202
- // Alias for title
203
- hint,
204
- hintPlaceholderColor = "blue",
205
- validate,
206
- defaultValue = "",
207
- initialValue,
208
- // Alias for defaultValue
209
- titleColor = "cyan",
210
- titleTypography = "none",
211
- titleVariant = "none",
212
- content,
213
- contentColor = "dim",
214
- contentTypography = "italic",
215
- contentVariant = "none",
216
- borderColor = "dim",
217
- placeholder,
218
- hardcoded,
219
- endTitle = "",
220
- endTitleColor = "dim",
221
- border = true,
222
- symbol,
223
- customSymbol,
224
- symbolColor,
225
- mode = "plain",
226
- mask,
227
- shouldStream = false,
228
- streamDelay = 20
229
- } = options;
230
- const finalTitle = message && title ? `${title}: ${message}` : message ?? title ?? "Input";
231
- const finalDefaultValue = defaultValue ?? initialValue;
232
- const terminal = readline.createInterface({
233
- input: process.stdin,
234
- output: process.stdout
235
- });
236
- async function endPrompt(isCtrlC) {
237
- await completePrompt(
238
- "input",
239
- isCtrlC,
240
- endTitle,
241
- endTitleColor,
242
- titleTypography,
243
- titleVariant,
244
- border,
245
- borderColor,
246
- void 0,
247
- false
248
- );
249
- terminal.close();
250
- if (isCtrlC) {
251
- process.exit(0);
252
- }
253
- }
254
- terminal.on("SIGINT", () => {
255
- void endPrompt(true);
256
- });
257
- let currentInput = hardcoded?.userInput ?? "";
258
- let errorMessage = hardcoded?.errorMessage ?? "";
259
- let showPlaceholder = hardcoded?.showPlaceholder ?? true;
260
- let isRerender = false;
261
- async function handleHardcodedInput() {
262
- msgUndoAll();
263
- await renderPromptUI({
264
- title: finalTitle,
265
- ...hint !== void 0 && { hint },
266
- ...hintPlaceholderColor !== void 0 && { hintPlaceholderColor },
267
- content: content ?? "",
268
- ...contentColor !== void 0 && { contentColor },
269
- ...contentTypography !== void 0 && { contentTypography },
270
- ...contentVariant !== void 0 && { contentVariant },
271
- titleColor,
272
- titleTypography,
273
- ...titleVariant !== void 0 && { titleVariant },
274
- borderColor,
275
- placeholder: showPlaceholder && placeholder ? placeholder : "",
276
- userInput: currentInput,
277
- errorMessage,
278
- border,
279
- ...symbol !== void 0 && { symbol },
280
- ...customSymbol !== void 0 && { customSymbol },
281
- ...symbolColor !== void 0 && { symbolColor },
282
- ...mask !== void 0 && { mask },
283
- shouldStream,
284
- streamDelay
285
- });
286
- const finalAnswer = currentInput || finalDefaultValue;
287
- const validated = await validateInput(finalAnswer, validate);
288
- if (!validated.isValid) {
289
- terminal.close();
290
- throw new Error(validated.errorMessage || "Invalid input.");
291
- }
292
- msg({ type: "M_MIDDLE", title: ` ${finalAnswer}` });
293
- msg({ type: "M_BAR", borderColor });
294
- terminal.close();
295
- return finalAnswer;
296
- }
297
- if (hardcoded?.userInput !== void 0) {
298
- return handleHardcodedInput();
299
- }
300
- while (true) {
301
- if (isRerender) {
302
- msgUndoAll();
303
- }
304
- const displayedUserInput = mode === "password" ? getMaskChar(mask).repeat(currentInput.length) : currentInput;
305
- if (errorMessage) {
306
- deleteLastLine();
307
- deleteLastLine();
308
- }
309
- await renderPromptUI({
310
- title: finalTitle,
311
- ...hint !== void 0 && { hint },
312
- hintPlaceholderColor,
313
- content: content ?? "",
314
- contentColor,
315
- contentTypography,
316
- ...contentVariant !== void 0 && { contentVariant },
317
- titleColor,
318
- titleTypography,
319
- ...titleVariant !== void 0 && { titleVariant },
320
- borderColor,
321
- placeholder: showPlaceholder && placeholder ? placeholder : "",
322
- userInput: displayedUserInput,
323
- errorMessage,
324
- border,
325
- ...symbol !== void 0 && { symbol },
326
- ...customSymbol !== void 0 && { customSymbol },
327
- ...symbolColor !== void 0 && { symbolColor },
328
- ...mask !== void 0 && { mask },
329
- shouldStream,
330
- streamDelay
331
- });
332
- if (errorMessage) {
333
- deleteLastLine();
334
- }
335
- const formattedBar = bar({ borderColor });
336
- const userInputRaw = await ask(`${formattedBar} `, mode, mask);
337
- isRerender = true;
338
- if (userInputRaw === null) {
339
- return "";
340
- }
341
- currentInput = userInputRaw.trim();
342
- if (showPlaceholder && currentInput !== "") {
343
- showPlaceholder = false;
344
- }
345
- const finalAnswer = currentInput || finalDefaultValue;
346
- const validated = await validateInput(finalAnswer, validate);
347
- if (validated.isValid) {
348
- if (!currentInput && finalDefaultValue) {
349
- if (mode === "password") {
350
- deleteLastLine();
351
- deleteLastLine();
352
- msg({
353
- type: "M_MIDDLE",
354
- title: ` ${getMaskChar(mask).repeat(finalDefaultValue.length)}`
355
- });
356
- } else {
357
- deleteLastLine();
358
- msg({ type: "M_MIDDLE", title: ` ${re.reset(finalDefaultValue)}` });
359
- }
360
- }
361
- if (errorMessage) {
362
- deleteLastLine();
363
- }
364
- msg({ type: "M_BAR", borderColor });
365
- terminal.close();
366
- return finalAnswer;
367
- }
368
- errorMessage = validated.errorMessage;
369
- }
370
- }
@@ -1,3 +0,0 @@
1
- import { introPrompt } from "../intro/intro-mod";
2
- export declare const startPrompt: typeof introPrompt;
3
- export declare const intro: typeof introPrompt;
@@ -1,3 +0,0 @@
1
- import { introPrompt } from "../intro/intro-mod.js";
2
- export const startPrompt = introPrompt;
3
- export const intro = introPrompt;
@@ -1,19 +0,0 @@
1
- import type { PreventWrongTerminalSizeOptions, PromptOptions } from "../../types";
2
- type StartPromptOptions = PromptOptions & {
3
- clearConsole?: boolean;
4
- horizontalLine?: boolean;
5
- horizontalLineLength?: number;
6
- packageName?: string;
7
- packageVersion?: string;
8
- terminalSizeOptions?: PreventWrongTerminalSizeOptions;
9
- isDev?: boolean;
10
- prevent?: {
11
- unsupportedTTY?: boolean;
12
- wrongTerminalSize?: boolean;
13
- windowsHomeDirRoot?: boolean;
14
- };
15
- variant?: "header" | "ascii-art";
16
- asciiArtFont?: any;
17
- };
18
- export declare function introPrompt(optionsOrTitle: StartPromptOptions | string): Promise<void>;
19
- export {};
@@ -1,71 +0,0 @@
1
- import { relinka } from "@reliverse/relinka";
2
- import { getCurrentTerminalName } from "@reliverse/reltime";
3
- import { msg } from "../msg-fmt/messages.js";
4
- import { getExactTerminalWidth, getTerminalHeight, getTerminalWidth } from "../msg-fmt/terminal.js";
5
- import {
6
- preventUnsupportedTTY,
7
- preventWindowsHomeDirRoot,
8
- preventWrongTerminalSize
9
- } from "../utils/prevent.js";
10
- import { pm, reliversePrompts } from "../utils/system.js";
11
- export async function introPrompt(optionsOrTitle) {
12
- const options = typeof optionsOrTitle === "string" ? { title: optionsOrTitle } : optionsOrTitle;
13
- const {
14
- title = "",
15
- titleColor = "inverse",
16
- titleTypography = "none",
17
- titleVariant,
18
- borderColor = "dim",
19
- clearConsole = false,
20
- horizontalLine = true,
21
- horizontalLineLength: initialHorizontalLineLength = 0,
22
- packageName = reliversePrompts.name,
23
- packageVersion = reliversePrompts.version,
24
- terminalSizeOptions = {},
25
- isDev = false,
26
- prevent = {
27
- unsupportedTTY: true,
28
- wrongTerminalSize: true,
29
- windowsHomeDirRoot: true
30
- },
31
- variant = "header"
32
- // asciiArtFont,
33
- } = options;
34
- let horizontalLineLength = initialHorizontalLineLength;
35
- if (prevent.windowsHomeDirRoot) {
36
- preventWindowsHomeDirRoot(process.cwd());
37
- }
38
- if (prevent.unsupportedTTY) {
39
- preventUnsupportedTTY();
40
- }
41
- if (prevent.wrongTerminalSize) {
42
- await preventWrongTerminalSize({ ...terminalSizeOptions, isDev });
43
- }
44
- const terminalWidth = getTerminalWidth();
45
- const exactTerminalWidth = getExactTerminalWidth();
46
- const terminalHeight = getTerminalHeight();
47
- const formattedTitle = title !== "" ? title : `${packageName} v${packageVersion} | ${pm.packageManager} v${pm.version} | ${getCurrentTerminalName()}${isDev && terminalWidth > 80 ? ` | isDev | w${terminalWidth} h${terminalHeight}` : ""}`;
48
- if (variant === "ascii-art") {
49
- return;
50
- }
51
- if (horizontalLineLength === 0) {
52
- const titleFullLength = titleColor === "inverse" ? `\u2800${formattedTitle}\u2800`.length + 5 : formattedTitle.length + 5;
53
- horizontalLineLength = Math.max(1, exactTerminalWidth - titleFullLength);
54
- }
55
- if (clearConsole) {
56
- relinka("clear", "");
57
- relinka("log", "");
58
- } else {
59
- relinka("log", "");
60
- }
61
- msg({
62
- type: "M_START",
63
- title: titleColor === "inverse" ? `\u2800${formattedTitle}\u2800` : formattedTitle,
64
- titleColor,
65
- titleTypography,
66
- ...titleVariant ? { titleVariant } : {},
67
- borderColor,
68
- horizontalLine,
69
- horizontalLineLength
70
- });
71
- }
@@ -1,31 +0,0 @@
1
- import type { ReliArgParserOptions } from "../reliarg/reliarg-mod";
2
- import type { ArgDefinitions, Command, CommandContext, EmptyArgs, InferArgTypes } from "./launcher-types";
3
- export interface CallCmdOptions {
4
- /** Whether to automatically exit process on errors (default: false for programmatic usage) */
5
- autoExit?: boolean;
6
- /** Whether to show debug output */
7
- debug?: boolean;
8
- /** Whether to call lifecycle hooks (onCmdInit/onCmdExit) */
9
- useLifecycleHooks?: boolean;
10
- /** Custom parser options for argv processing */
11
- parserOptions?: ReliArgParserOptions;
12
- }
13
- /**
14
- * Programmatically call a defineCommand command with arguments.
15
- * Fully compatible with launcher-mod.ts execution logic.
16
- *
17
- * @param command - The command definition created with defineCommand()
18
- * @param input - Either argv array (CLI-style) or args object (programmatic style)
19
- * @param options - Optional configuration for execution
20
- * @returns Promise resolving to the command context
21
- *
22
- * @example
23
- * ```ts
24
- * // CLI-style with argv array
25
- * const result = await callCmd(myCommand, ['--flag', 'value', 'positional']);
26
- *
27
- * // Programmatic style with object
28
- * const result = await callCmd(myCommand, { flag: true, name: 'value' });
29
- * ```
30
- */
31
- export declare function callCmd<A extends ArgDefinitions = EmptyArgs>(command: Command<A>, input: string[] | Partial<InferArgTypes<A>>, options?: CallCmdOptions): Promise<CommandContext<InferArgTypes<A>>>;