convoker 0.3.3 → 0.3.4
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.
- package/dist/chunk-z5eko27R.mjs +13 -0
- package/dist/color-BuHvMolk.d.mts +158 -0
- package/dist/color-OlJQTTxb.mjs +172 -0
- package/dist/color.d.mts +2 -0
- package/dist/color.mjs +4 -0
- package/dist/command-BXmfoT-l.d.mts +331 -0
- package/dist/command-D2UiQBNA.mjs +583 -0
- package/dist/command.d.mts +5 -0
- package/dist/command.mjs +10 -0
- package/dist/error-C1S1gs8L.mjs +115 -0
- package/dist/error.d.mts +5 -0
- package/dist/error.mjs +3 -0
- package/dist/index-Dikc5KAP.d.mts +199 -0
- package/dist/index.d.mts +73 -0
- package/dist/index.mjs +10 -0
- package/dist/input-B12iaqb8.d.mts +187 -0
- package/dist/input-DRy_sVxZ.mjs +174 -0
- package/dist/input.d.mts +3 -0
- package/dist/input.mjs +5 -0
- package/dist/prompt/index.d.mts +5 -0
- package/dist/prompt/index.mjs +8 -0
- package/dist/prompt/raw.d.mts +2 -0
- package/dist/prompt/raw.mjs +4 -0
- package/dist/prompt-Cvufljin.mjs +248 -0
- package/dist/raw--889icsd.mjs +105 -0
- package/dist/raw-BqvlveTU.d.mts +37 -0
- package/dist/standard-schema-DBXbMy6L.mjs +17 -0
- package/dist/standard-schema-DLeKaehR.d.mts +58 -0
- package/dist/utils-ChmY93uA.mjs +45 -0
- package/package.json +20 -19
- package/dist/color.d.ts +0 -153
- package/dist/color.js +0 -143
- package/dist/command.d.ts +0 -218
- package/dist/command.js +0 -531
- package/dist/error.d.ts +0 -107
- package/dist/error.js +0 -100
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -6
- package/dist/input.d.ts +0 -182
- package/dist/input.js +0 -185
- package/dist/log.d.ts +0 -61
- package/dist/log.js +0 -216
- package/dist/prompt/index.d.ts +0 -193
- package/dist/prompt/index.js +0 -273
- package/dist/prompt/raw.d.ts +0 -32
- package/dist/prompt/raw.js +0 -105
- package/dist/standard-schema.d.ts +0 -62
- package/dist/standard-schema.js +0 -16
- package/dist/utils.d.ts +0 -30
- package/dist/utils.js +0 -56
package/dist/color.d.ts
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* If the runtime supports color.
|
|
3
|
-
*/
|
|
4
|
-
export declare const supportsColor: boolean;
|
|
5
|
-
/**
|
|
6
|
-
* Creates a function that wraps a string in ANSI codes.
|
|
7
|
-
* @param open The opening ANSI code.
|
|
8
|
-
* @param close The closing ANSI code.
|
|
9
|
-
* @returns A function that wraps the string in ANSI codes.
|
|
10
|
-
*/
|
|
11
|
-
export declare function createAnsiColor(open: number, close: number): (input: any) => string;
|
|
12
|
-
export declare const reset: (input: any) => string;
|
|
13
|
-
export declare const bold: (input: any) => string;
|
|
14
|
-
export declare const dim: (input: any) => string;
|
|
15
|
-
export declare const italic: (input: any) => string;
|
|
16
|
-
export declare const underline: (input: any) => string;
|
|
17
|
-
export declare const overline: (input: any) => string;
|
|
18
|
-
export declare const inverse: (input: any) => string;
|
|
19
|
-
export declare const hidden: (input: any) => string;
|
|
20
|
-
export declare const strikethrough: (input: any) => string;
|
|
21
|
-
export declare const black: (input: any) => string;
|
|
22
|
-
export declare const red: (input: any) => string;
|
|
23
|
-
export declare const green: (input: any) => string;
|
|
24
|
-
export declare const yellow: (input: any) => string;
|
|
25
|
-
export declare const blue: (input: any) => string;
|
|
26
|
-
export declare const magenta: (input: any) => string;
|
|
27
|
-
export declare const cyan: (input: any) => string;
|
|
28
|
-
export declare const white: (input: any) => string;
|
|
29
|
-
export declare const gray: (input: any) => string;
|
|
30
|
-
export declare const bgBlack: (input: any) => string;
|
|
31
|
-
export declare const bgRed: (input: any) => string;
|
|
32
|
-
export declare const bgGreen: (input: any) => string;
|
|
33
|
-
export declare const bgYellow: (input: any) => string;
|
|
34
|
-
export declare const bgBlue: (input: any) => string;
|
|
35
|
-
export declare const bgMagenta: (input: any) => string;
|
|
36
|
-
export declare const bgCyan: (input: any) => string;
|
|
37
|
-
export declare const bgWhite: (input: any) => string;
|
|
38
|
-
export declare const bgGray: (input: any) => string;
|
|
39
|
-
export declare const redBright: (input: any) => string;
|
|
40
|
-
export declare const greenBright: (input: any) => string;
|
|
41
|
-
export declare const yellowBright: (input: any) => string;
|
|
42
|
-
export declare const blueBright: (input: any) => string;
|
|
43
|
-
export declare const magentaBright: (input: any) => string;
|
|
44
|
-
export declare const cyanBright: (input: any) => string;
|
|
45
|
-
export declare const whiteBright: (input: any) => string;
|
|
46
|
-
export declare const bgRedBright: (input: any) => string;
|
|
47
|
-
export declare const bgGreenBright: (input: any) => string;
|
|
48
|
-
export declare const bgYellowBright: (input: any) => string;
|
|
49
|
-
export declare const bgBlueBright: (input: any) => string;
|
|
50
|
-
export declare const bgMagentaBright: (input: any) => string;
|
|
51
|
-
export declare const bgCyanBright: (input: any) => string;
|
|
52
|
-
export declare const bgWhiteBright: (input: any) => string;
|
|
53
|
-
/**
|
|
54
|
-
* A theme.
|
|
55
|
-
*/
|
|
56
|
-
export interface Theme {
|
|
57
|
-
/**
|
|
58
|
-
* Wraps a string in a background ANSI code.
|
|
59
|
-
* @param a The string to wrap.
|
|
60
|
-
*/
|
|
61
|
-
background?(a: string): string;
|
|
62
|
-
/**
|
|
63
|
-
* Wraps a string in a foreground ANSI code.
|
|
64
|
-
* @param a The string to wrap.
|
|
65
|
-
*/
|
|
66
|
-
foreground?(a: string): string;
|
|
67
|
-
/**
|
|
68
|
-
* Wraps a string in a primary ANSI code.
|
|
69
|
-
* @param a The string to wrap.
|
|
70
|
-
*/
|
|
71
|
-
primary(a: string): string;
|
|
72
|
-
/**
|
|
73
|
-
* Wraps a string in a secondary ANSI code.
|
|
74
|
-
* @param a The string to wrap.
|
|
75
|
-
*/
|
|
76
|
-
secondary(a: string): string;
|
|
77
|
-
/**
|
|
78
|
-
* Wraps a string in a accent ANSI code.
|
|
79
|
-
* @param a The string to wrap.
|
|
80
|
-
*/
|
|
81
|
-
accent?(a: string): string;
|
|
82
|
-
/**
|
|
83
|
-
* Wraps a string in a success ANSI code.
|
|
84
|
-
* @param a The string to wrap.
|
|
85
|
-
*/
|
|
86
|
-
success(a: string): string;
|
|
87
|
-
/**
|
|
88
|
-
* Wraps a string in a warning ANSI code.
|
|
89
|
-
* @param a The string to wrap.
|
|
90
|
-
*/
|
|
91
|
-
warning(a: string): string;
|
|
92
|
-
/**
|
|
93
|
-
* Wraps a string in a error ANSI code.
|
|
94
|
-
* @param a The string to wrap.
|
|
95
|
-
*/
|
|
96
|
-
error(a: string): string;
|
|
97
|
-
/**
|
|
98
|
-
* Wraps a string in a info ANSI code.
|
|
99
|
-
* @param a The string to wrap.
|
|
100
|
-
*/
|
|
101
|
-
info?(a: string): string;
|
|
102
|
-
/**
|
|
103
|
-
* Set of symbols for logging.
|
|
104
|
-
*/
|
|
105
|
-
symbols?: {
|
|
106
|
-
/**
|
|
107
|
-
* Success message symbol.
|
|
108
|
-
*/
|
|
109
|
-
success: string;
|
|
110
|
-
/**
|
|
111
|
-
* Error message symbol.
|
|
112
|
-
*/
|
|
113
|
-
error: string;
|
|
114
|
-
/**
|
|
115
|
-
* Warning message symbol.
|
|
116
|
-
*/
|
|
117
|
-
warning: string;
|
|
118
|
-
/**
|
|
119
|
-
* Information message symbol.
|
|
120
|
-
*/
|
|
121
|
-
info?: string;
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* Optional styles.
|
|
125
|
-
*/
|
|
126
|
-
styles?: {
|
|
127
|
-
/**
|
|
128
|
-
* Wraps a string in a bold ANSI code.
|
|
129
|
-
* @param a The string to wrap.
|
|
130
|
-
*/
|
|
131
|
-
bold?(a: string): string;
|
|
132
|
-
/**
|
|
133
|
-
* Wraps a string in an italic ANSI code.
|
|
134
|
-
* @param a The string to wrap.
|
|
135
|
-
*/
|
|
136
|
-
italic?(a: string): string;
|
|
137
|
-
/**
|
|
138
|
-
* Wraps a string in an underline ANSI code.
|
|
139
|
-
* @param a The string to wrap.
|
|
140
|
-
*/
|
|
141
|
-
underline?(a: string): string;
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* The default theme.
|
|
146
|
-
*/
|
|
147
|
-
export declare const DEFAULT_THEME: Theme;
|
|
148
|
-
/**
|
|
149
|
-
* Defines a theme.
|
|
150
|
-
* @param theme The (partial) theme.
|
|
151
|
-
* @returns The theme, merged with the default theme.
|
|
152
|
-
*/
|
|
153
|
-
export declare function defineTheme(theme: Partial<Theme>): Theme;
|
package/dist/color.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { merge } from "./utils";
|
|
2
|
-
/**
|
|
3
|
-
* Detects if the runtime supports colored output.
|
|
4
|
-
* @returns If the runtime supports colored output.
|
|
5
|
-
*/
|
|
6
|
-
function detectColorSupport() {
|
|
7
|
-
// If running in a browser-like environment, return false
|
|
8
|
-
if (typeof window !== "undefined" && typeof window.document !== "undefined") {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
const env = typeof process !== "undefined" ? (process.env ?? {}) : {};
|
|
12
|
-
// Force-disable colors if NO_COLOR is set
|
|
13
|
-
if ("NO_COLOR" in env)
|
|
14
|
-
return false;
|
|
15
|
-
// Force-enable if FORCE_COLOR is set
|
|
16
|
-
if ("FORCE_COLOR" in env)
|
|
17
|
-
return true;
|
|
18
|
-
// Check for CI systems that support color
|
|
19
|
-
if ("CI" in env) {
|
|
20
|
-
if ([
|
|
21
|
-
"TRAVIS",
|
|
22
|
-
"CIRCLECI",
|
|
23
|
-
"APPVEYOR",
|
|
24
|
-
"GITLAB_CI",
|
|
25
|
-
"GITHUB_ACTIONS",
|
|
26
|
-
"BUILDKITE",
|
|
27
|
-
"DRONE",
|
|
28
|
-
].some((k) => k in env) ||
|
|
29
|
-
env.CI_NAME === "codeship") {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
// Deno detection
|
|
35
|
-
if (typeof Deno !== "undefined" && Deno.noColor !== undefined) {
|
|
36
|
-
return !Deno.noColor;
|
|
37
|
-
}
|
|
38
|
-
// Node.js or Bun detection
|
|
39
|
-
if (typeof process !== "undefined" && process.stdout) {
|
|
40
|
-
const term = env.TERM || "";
|
|
41
|
-
const colorterm = env.COLORTERM || "";
|
|
42
|
-
if (colorterm.length > 0)
|
|
43
|
-
return true;
|
|
44
|
-
if (term === "dumb")
|
|
45
|
-
return false;
|
|
46
|
-
return /(color|ansi|cygwin|xterm|vt100)/i.test(term);
|
|
47
|
-
}
|
|
48
|
-
// Other runtimes/Node without TTY
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* If the runtime supports color.
|
|
53
|
-
*/
|
|
54
|
-
export const supportsColor = detectColorSupport();
|
|
55
|
-
/**
|
|
56
|
-
* Creates a function that wraps a string in ANSI codes.
|
|
57
|
-
* @param open The opening ANSI code.
|
|
58
|
-
* @param close The closing ANSI code.
|
|
59
|
-
* @returns A function that wraps the string in ANSI codes.
|
|
60
|
-
*/
|
|
61
|
-
export function createAnsiColor(open, close) {
|
|
62
|
-
const openCode = `\u001b[${open}m`;
|
|
63
|
-
const closeCode = `\u001b[${close}m`;
|
|
64
|
-
if (!supportsColor)
|
|
65
|
-
return (input) => input + "";
|
|
66
|
-
return (input) => {
|
|
67
|
-
if (!input)
|
|
68
|
-
return openCode + closeCode;
|
|
69
|
-
const str = input + "";
|
|
70
|
-
// replace any existing close codes with reopen
|
|
71
|
-
const replaced = str.replace(new RegExp(`\u001b\\[${close}m`, "g"), closeCode + openCode);
|
|
72
|
-
return openCode + replaced + closeCode;
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
export const reset = createAnsiColor(0, 0);
|
|
76
|
-
export const bold = createAnsiColor(1, 22);
|
|
77
|
-
export const dim = createAnsiColor(2, 22);
|
|
78
|
-
export const italic = createAnsiColor(3, 23);
|
|
79
|
-
export const underline = createAnsiColor(4, 24);
|
|
80
|
-
export const overline = createAnsiColor(53, 55);
|
|
81
|
-
export const inverse = createAnsiColor(7, 27);
|
|
82
|
-
export const hidden = createAnsiColor(8, 28);
|
|
83
|
-
export const strikethrough = createAnsiColor(9, 29);
|
|
84
|
-
export const black = createAnsiColor(30, 39);
|
|
85
|
-
export const red = createAnsiColor(31, 39);
|
|
86
|
-
export const green = createAnsiColor(32, 39);
|
|
87
|
-
export const yellow = createAnsiColor(33, 39);
|
|
88
|
-
export const blue = createAnsiColor(34, 39);
|
|
89
|
-
export const magenta = createAnsiColor(35, 39);
|
|
90
|
-
export const cyan = createAnsiColor(36, 39);
|
|
91
|
-
export const white = createAnsiColor(37, 39);
|
|
92
|
-
export const gray = createAnsiColor(90, 39);
|
|
93
|
-
export const bgBlack = createAnsiColor(40, 49);
|
|
94
|
-
export const bgRed = createAnsiColor(41, 49);
|
|
95
|
-
export const bgGreen = createAnsiColor(42, 49);
|
|
96
|
-
export const bgYellow = createAnsiColor(43, 49);
|
|
97
|
-
export const bgBlue = createAnsiColor(44, 49);
|
|
98
|
-
export const bgMagenta = createAnsiColor(45, 49);
|
|
99
|
-
export const bgCyan = createAnsiColor(46, 49);
|
|
100
|
-
export const bgWhite = createAnsiColor(47, 49);
|
|
101
|
-
export const bgGray = createAnsiColor(100, 49);
|
|
102
|
-
export const redBright = createAnsiColor(91, 39);
|
|
103
|
-
export const greenBright = createAnsiColor(92, 39);
|
|
104
|
-
export const yellowBright = createAnsiColor(93, 39);
|
|
105
|
-
export const blueBright = createAnsiColor(94, 39);
|
|
106
|
-
export const magentaBright = createAnsiColor(95, 39);
|
|
107
|
-
export const cyanBright = createAnsiColor(96, 39);
|
|
108
|
-
export const whiteBright = createAnsiColor(97, 39);
|
|
109
|
-
export const bgRedBright = createAnsiColor(101, 49);
|
|
110
|
-
export const bgGreenBright = createAnsiColor(102, 49);
|
|
111
|
-
export const bgYellowBright = createAnsiColor(103, 49);
|
|
112
|
-
export const bgBlueBright = createAnsiColor(104, 49);
|
|
113
|
-
export const bgMagentaBright = createAnsiColor(105, 49);
|
|
114
|
-
export const bgCyanBright = createAnsiColor(106, 49);
|
|
115
|
-
export const bgWhiteBright = createAnsiColor(107, 49);
|
|
116
|
-
/**
|
|
117
|
-
* The default theme.
|
|
118
|
-
*/
|
|
119
|
-
export const DEFAULT_THEME = {
|
|
120
|
-
primary: cyan,
|
|
121
|
-
secondary: gray,
|
|
122
|
-
success: green,
|
|
123
|
-
warning: yellow,
|
|
124
|
-
error: red,
|
|
125
|
-
symbols: {
|
|
126
|
-
success: "✔",
|
|
127
|
-
error: "✖",
|
|
128
|
-
warning: "⚠",
|
|
129
|
-
},
|
|
130
|
-
styles: {
|
|
131
|
-
bold: bold,
|
|
132
|
-
italic: italic,
|
|
133
|
-
underline: underline,
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* Defines a theme.
|
|
138
|
-
* @param theme The (partial) theme.
|
|
139
|
-
* @returns The theme, merged with the default theme.
|
|
140
|
-
*/
|
|
141
|
-
export function defineTheme(theme) {
|
|
142
|
-
return merge(DEFAULT_THEME, theme);
|
|
143
|
-
}
|
package/dist/command.d.ts
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { type Theme } from "./color";
|
|
2
|
-
import { ConvokerError } from "./error";
|
|
3
|
-
import { type InferInput, type Input } from "./input";
|
|
4
|
-
/**
|
|
5
|
-
* What the command is an alias for.
|
|
6
|
-
*/
|
|
7
|
-
export interface CommandAlias<T extends Input = Input> {
|
|
8
|
-
/**
|
|
9
|
-
* A pointer to the command.
|
|
10
|
-
*/
|
|
11
|
-
command: Command<T>;
|
|
12
|
-
/**
|
|
13
|
-
* The name of the command this is an alias for.
|
|
14
|
-
*/
|
|
15
|
-
alias?: string;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* The result of the `Command.parse` function.
|
|
19
|
-
*/
|
|
20
|
-
export interface ParseResult<T extends Input> {
|
|
21
|
-
/**
|
|
22
|
-
* A pointer to the command to run.
|
|
23
|
-
*/
|
|
24
|
-
command: Command<T>;
|
|
25
|
-
/**
|
|
26
|
-
* The input to pass into the command.
|
|
27
|
-
*/
|
|
28
|
-
input: InferInput<T>;
|
|
29
|
-
/**
|
|
30
|
-
* Errors collected during parsing.
|
|
31
|
-
*/
|
|
32
|
-
errors: ConvokerError[];
|
|
33
|
-
/**
|
|
34
|
-
* If this should result in displaying the version of the command.
|
|
35
|
-
*/
|
|
36
|
-
isVersion: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* If this should result in displaying a help screen.
|
|
39
|
-
*/
|
|
40
|
-
isHelp: boolean;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Command action function.
|
|
44
|
-
*/
|
|
45
|
-
export type ActionFn<T extends Input> = (input: InferInput<T>) => any | Promise<any>;
|
|
46
|
-
/**
|
|
47
|
-
* Command middleware function.
|
|
48
|
-
*/
|
|
49
|
-
export type MiddlewareFn<T extends Input = Input> = (input: InferInput<T>, next: () => Promise<any>) => any | Promise<any>;
|
|
50
|
-
/**
|
|
51
|
-
* Command error handler.
|
|
52
|
-
*/
|
|
53
|
-
export type ErrorFn<T extends Input> = (command: Command<T>, errors: Error[], input: Partial<InferInput<T>>) => void | Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Builder for commands.
|
|
56
|
-
*/
|
|
57
|
-
export type Builder = (c: Command<any>) => Command<any> | void;
|
|
58
|
-
/**
|
|
59
|
-
* A command.
|
|
60
|
-
*/
|
|
61
|
-
export declare class Command<T extends Input = Input> {
|
|
62
|
-
/**
|
|
63
|
-
* The names (aliases) of this command.
|
|
64
|
-
*/
|
|
65
|
-
$names: string[];
|
|
66
|
-
/**
|
|
67
|
-
* The description of this command.
|
|
68
|
-
*/
|
|
69
|
-
$description: string | undefined;
|
|
70
|
-
/**
|
|
71
|
-
* The theme of this command
|
|
72
|
-
*/
|
|
73
|
-
$theme: Theme | undefined;
|
|
74
|
-
/**
|
|
75
|
-
* The version of this command.
|
|
76
|
-
*/
|
|
77
|
-
$version: string | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* The children of this command.
|
|
80
|
-
*/
|
|
81
|
-
$children: Map<string, CommandAlias>;
|
|
82
|
-
/**
|
|
83
|
-
* The parent of this command.
|
|
84
|
-
*/
|
|
85
|
-
$parent: Command<any> | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* If this command allows unknown options.
|
|
88
|
-
*/
|
|
89
|
-
$allowUnknownOptions: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* If you should be able to surpass the amount of positional arguments defined in the input.
|
|
92
|
-
*/
|
|
93
|
-
$allowSurpassArgLimit: boolean;
|
|
94
|
-
/**
|
|
95
|
-
* The input this command takes.
|
|
96
|
-
*/
|
|
97
|
-
$input: T;
|
|
98
|
-
/**
|
|
99
|
-
* The action function of this command.
|
|
100
|
-
*/
|
|
101
|
-
$fn: ActionFn<T> | undefined;
|
|
102
|
-
/**
|
|
103
|
-
* The middlewares associated with this command.
|
|
104
|
-
*/
|
|
105
|
-
$middlewares: MiddlewareFn<T>[];
|
|
106
|
-
/**
|
|
107
|
-
* The error handler of this command.
|
|
108
|
-
*/
|
|
109
|
-
$errorFn: ErrorFn<T> | undefined;
|
|
110
|
-
/**
|
|
111
|
-
* Creates a new command.
|
|
112
|
-
* @param names The names (aliases).
|
|
113
|
-
* @param desc The description.
|
|
114
|
-
* @param version The version.
|
|
115
|
-
*/
|
|
116
|
-
constructor(names: string | string[], desc?: string, version?: string);
|
|
117
|
-
/**
|
|
118
|
-
* Adds a set of aliases to this command.
|
|
119
|
-
* @param aliases The aliases to add.
|
|
120
|
-
* @returns this
|
|
121
|
-
*/
|
|
122
|
-
alias(...aliases: string[]): this;
|
|
123
|
-
/**
|
|
124
|
-
* Adds a description to this command.
|
|
125
|
-
* @param desc The description.
|
|
126
|
-
* @returns this
|
|
127
|
-
*/
|
|
128
|
-
description(desc: string): this;
|
|
129
|
-
/**
|
|
130
|
-
* Adds a version to this command.
|
|
131
|
-
* @param version The version.
|
|
132
|
-
* @returns this
|
|
133
|
-
*/
|
|
134
|
-
version(version: string): this;
|
|
135
|
-
/**
|
|
136
|
-
* Sets the input for this command.
|
|
137
|
-
* @param version The input.
|
|
138
|
-
* @returns this
|
|
139
|
-
*/
|
|
140
|
-
input<TInput extends Input>(input: TInput): Command<TInput>;
|
|
141
|
-
/**
|
|
142
|
-
* Adds a chain of middlewares.
|
|
143
|
-
* @param fns The middlewares to use.
|
|
144
|
-
* @returns this
|
|
145
|
-
*/
|
|
146
|
-
use(...fns: MiddlewareFn<T>[]): this;
|
|
147
|
-
/**
|
|
148
|
-
* Sets the action function for this command.
|
|
149
|
-
* @param fn The action.
|
|
150
|
-
* @returns this
|
|
151
|
-
*/
|
|
152
|
-
action(fn: ActionFn<T>): this;
|
|
153
|
-
/**
|
|
154
|
-
* Sets the error function for this command.
|
|
155
|
-
* @param fn The error handler.
|
|
156
|
-
* @returns this
|
|
157
|
-
*/
|
|
158
|
-
error(fn: ErrorFn<T>): this;
|
|
159
|
-
/**
|
|
160
|
-
* Adds an existing command to this.
|
|
161
|
-
* @param command The command.
|
|
162
|
-
* @returns this
|
|
163
|
-
*/
|
|
164
|
-
add(command: Command<any>): this;
|
|
165
|
-
/**
|
|
166
|
-
* Creates a new subcommand and adds it.
|
|
167
|
-
* @param names The aliases of the subcommand.
|
|
168
|
-
* @param builder A builder to create the command.
|
|
169
|
-
*/
|
|
170
|
-
subCommand(names: string | string[], builder: Builder): this;
|
|
171
|
-
/**
|
|
172
|
-
* Creates a new subcommand and adds it.
|
|
173
|
-
* @param names The aliases of the subcommand.
|
|
174
|
-
* @param desc The description of the subcommand.
|
|
175
|
-
* @param version The version of the subcommand.
|
|
176
|
-
*/
|
|
177
|
-
subCommand(names: string | string[], desc?: string, version?: string): Command<any>;
|
|
178
|
-
/**
|
|
179
|
-
* Allows unknown options.
|
|
180
|
-
* @returns this
|
|
181
|
-
*/
|
|
182
|
-
allowUnknownOptions(): this;
|
|
183
|
-
/**
|
|
184
|
-
* Parses a set of command-line arguments.
|
|
185
|
-
* @param argv The arguments to parse.
|
|
186
|
-
* @returns A parse result.
|
|
187
|
-
*/
|
|
188
|
-
parse(argv: string[]): Promise<ParseResult<T>>;
|
|
189
|
-
private buildInputMap;
|
|
190
|
-
/**
|
|
191
|
-
* Allows surpassing the amount of arguments specified.
|
|
192
|
-
* @returns this
|
|
193
|
-
*/
|
|
194
|
-
allowSurpassArgLimit(): this;
|
|
195
|
-
/**
|
|
196
|
-
* Gets the full command path (name including parents).
|
|
197
|
-
* @returns The full command path.
|
|
198
|
-
*/
|
|
199
|
-
fullCommandPath(): string;
|
|
200
|
-
/**
|
|
201
|
-
* The default error screen.
|
|
202
|
-
* @param errors The errors.
|
|
203
|
-
*/
|
|
204
|
-
defaultErrorScreen(errors: Error[]): void;
|
|
205
|
-
/**
|
|
206
|
-
* Handles a set of errors.
|
|
207
|
-
* @param errors The errors to handle.
|
|
208
|
-
* @param input The parsed input, if possible.
|
|
209
|
-
* @returns this
|
|
210
|
-
*/
|
|
211
|
-
handleErrors(errors: Error[], input?: Partial<InferInput<T>>): Promise<this>;
|
|
212
|
-
/**
|
|
213
|
-
* Runs a command.
|
|
214
|
-
* @param argv The arguments to run the command with. Defaults to your runtime's `argv` equivalent.
|
|
215
|
-
* @returns this
|
|
216
|
-
*/
|
|
217
|
-
run(argv?: string[]): Promise<this>;
|
|
218
|
-
}
|