convoker 0.3.0 → 0.3.3
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/color.d.ts +153 -200
- package/dist/color.js +142 -48
- package/dist/command.d.ts +218 -555
- package/dist/command.js +513 -448
- package/dist/error.d.ts +107 -864
- package/dist/error.js +100 -10
- package/dist/index.d.ts +6 -1224
- package/dist/index.js +6 -13
- package/dist/input.d.ts +182 -252
- package/dist/input.js +185 -10
- package/dist/log.d.ts +61 -0
- package/dist/log.js +216 -0
- package/dist/{prompt.d.ts → prompt/index.d.ts} +193 -258
- package/dist/prompt/index.js +273 -0
- package/dist/prompt/raw.js +105 -9
- package/dist/standard-schema.d.ts +62 -0
- package/dist/standard-schema.js +16 -0
- package/dist/utils.d.ts +30 -0
- package/dist/utils.js +56 -0
- package/package.json +15 -12
- package/dist/chunks/__vite-browser-external-DQYBmsno.js +0 -80
- package/dist/chunks/color-CiruG_zQ.js +0 -153
- package/dist/chunks/error-CyKscMUD.js +0 -95
- package/dist/chunks/index-BluQjWvw.js +0 -198
- package/dist/chunks/input-WNu16aNE.js +0 -138
- package/dist/chunks/standard-schema-BHKzvwIS.js +0 -12
- package/dist/chunks/utils-DdmSEjLc.js +0 -22
- package/dist/prompt.js +0 -17
- package/dist/raw.d.ts +0 -38
|
@@ -1,258 +1,193 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
* @param opts Options for
|
|
73
|
-
* @returns The
|
|
74
|
-
*/
|
|
75
|
-
export declare function
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
*
|
|
99
|
-
*/
|
|
100
|
-
export
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
*
|
|
180
|
-
*/
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
export declare interface SelectOption<T> {
|
|
195
|
-
/**
|
|
196
|
-
* The label (what gets displayed) of the select option.
|
|
197
|
-
*/
|
|
198
|
-
label: string;
|
|
199
|
-
/**
|
|
200
|
-
* The value (what gets returned) of the select option.
|
|
201
|
-
*/
|
|
202
|
-
value: T;
|
|
203
|
-
/**
|
|
204
|
-
* A description of the option.
|
|
205
|
-
*/
|
|
206
|
-
hint?: string;
|
|
207
|
-
/**
|
|
208
|
-
* If this option is disabled.
|
|
209
|
-
*/
|
|
210
|
-
disabled?: boolean;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Options for select input.
|
|
215
|
-
*/
|
|
216
|
-
export declare interface SelectOpts<T> extends BaseOpts<T> {
|
|
217
|
-
/**
|
|
218
|
-
* Every option the user can pick from.
|
|
219
|
-
*/
|
|
220
|
-
options: SelectOption<T>[];
|
|
221
|
-
/**
|
|
222
|
-
* The initial option selected.
|
|
223
|
-
*/
|
|
224
|
-
initialIndex?: number;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Sets the theme of the prompts.
|
|
229
|
-
* @param t The new theme.
|
|
230
|
-
*/
|
|
231
|
-
export declare function setTheme(t: Theme): void;
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Prompts the user for text input.
|
|
235
|
-
* @param opts Options for text input.
|
|
236
|
-
* @returns The text the user typed in, or the default.
|
|
237
|
-
*/
|
|
238
|
-
export declare function text(opts: TextOpts): Promise<string>;
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Options for text input.
|
|
242
|
-
*/
|
|
243
|
-
export declare interface TextOpts extends BaseOpts<string> {
|
|
244
|
-
/**
|
|
245
|
-
* A placeholder, displayed when the user hasn't typed anything yet.
|
|
246
|
-
*/
|
|
247
|
-
placeholder?: string;
|
|
248
|
-
/**
|
|
249
|
-
* Minimum length of the input.
|
|
250
|
-
*/
|
|
251
|
-
minLength?: number;
|
|
252
|
-
/**
|
|
253
|
-
* Maximum length of the input.
|
|
254
|
-
*/
|
|
255
|
-
maxLength?: number;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
export { }
|
|
1
|
+
import { type Theme } from "../color";
|
|
2
|
+
import { type StandardSchemaV1 } from "../standard-schema";
|
|
3
|
+
import * as raw from "./raw";
|
|
4
|
+
/**
|
|
5
|
+
* Sets the theme of the prompts.
|
|
6
|
+
* @param t The new theme.
|
|
7
|
+
*/
|
|
8
|
+
export declare function setTheme(t: Theme): void;
|
|
9
|
+
/**
|
|
10
|
+
* Base options for prompts.
|
|
11
|
+
*/
|
|
12
|
+
export interface BaseOpts<T> {
|
|
13
|
+
/**
|
|
14
|
+
* The message of the prompt.
|
|
15
|
+
*/
|
|
16
|
+
message: string;
|
|
17
|
+
/**
|
|
18
|
+
* An `AbortSignal` to cancel the prompt.
|
|
19
|
+
*/
|
|
20
|
+
signal?: AbortSignal;
|
|
21
|
+
/**
|
|
22
|
+
* The default value.
|
|
23
|
+
*/
|
|
24
|
+
default?: T;
|
|
25
|
+
/**
|
|
26
|
+
* The theme of the prompt.
|
|
27
|
+
*/
|
|
28
|
+
theme?: Theme;
|
|
29
|
+
/**
|
|
30
|
+
* A validator function, or a Standard Schema validator.
|
|
31
|
+
*/
|
|
32
|
+
validate?: StandardSchemaV1<any, T> | ((value: T) => boolean | T);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Options for text input.
|
|
36
|
+
*/
|
|
37
|
+
export interface TextOpts extends BaseOpts<string> {
|
|
38
|
+
/**
|
|
39
|
+
* A placeholder, displayed when the user hasn't typed anything yet.
|
|
40
|
+
*/
|
|
41
|
+
placeholder?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Minimum length of the input.
|
|
44
|
+
*/
|
|
45
|
+
minLength?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Maximum length of the input.
|
|
48
|
+
*/
|
|
49
|
+
maxLength?: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Prompts the user for text input.
|
|
53
|
+
* @param opts Options for text input.
|
|
54
|
+
* @returns The text the user typed in, or the default.
|
|
55
|
+
*/
|
|
56
|
+
export declare function text(opts: TextOpts): Promise<string>;
|
|
57
|
+
/**
|
|
58
|
+
* Options for password input.
|
|
59
|
+
*/
|
|
60
|
+
export interface PasswordOpts extends TextOpts {
|
|
61
|
+
/**
|
|
62
|
+
* The mask for the password input.
|
|
63
|
+
*/
|
|
64
|
+
mask?: string;
|
|
65
|
+
/**
|
|
66
|
+
* If the user should be asked to confirm the password, by typing it again.
|
|
67
|
+
*/
|
|
68
|
+
confirm?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Prompts the user for a password.
|
|
72
|
+
* @param opts Options for password input.
|
|
73
|
+
* @returns The password.
|
|
74
|
+
*/
|
|
75
|
+
export declare function password(opts: PasswordOpts): Promise<string>;
|
|
76
|
+
/**
|
|
77
|
+
* An option for select input.
|
|
78
|
+
*/
|
|
79
|
+
export interface SelectOption<T> {
|
|
80
|
+
/**
|
|
81
|
+
* The label (what gets displayed) of the select option.
|
|
82
|
+
*/
|
|
83
|
+
label: string;
|
|
84
|
+
/**
|
|
85
|
+
* The value (what gets returned) of the select option.
|
|
86
|
+
*/
|
|
87
|
+
value: T;
|
|
88
|
+
/**
|
|
89
|
+
* A description of the option.
|
|
90
|
+
*/
|
|
91
|
+
hint?: string;
|
|
92
|
+
/**
|
|
93
|
+
* If this option is disabled.
|
|
94
|
+
*/
|
|
95
|
+
disabled?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Options for select input.
|
|
99
|
+
*/
|
|
100
|
+
export interface SelectOpts<T> extends BaseOpts<T> {
|
|
101
|
+
/**
|
|
102
|
+
* Every option the user can pick from.
|
|
103
|
+
*/
|
|
104
|
+
options: SelectOption<T>[];
|
|
105
|
+
/**
|
|
106
|
+
* The initial option selected.
|
|
107
|
+
*/
|
|
108
|
+
initialIndex?: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Prompts the user to select a single option.
|
|
112
|
+
* @param opts Options for select input.
|
|
113
|
+
* @returns The selected option's value.
|
|
114
|
+
*/
|
|
115
|
+
export declare function select<T>(opts: SelectOpts<T>): Promise<T>;
|
|
116
|
+
/**
|
|
117
|
+
* Prompts the user to select multiple options.
|
|
118
|
+
* @param opts Options for select input.
|
|
119
|
+
* @returns The selected options.
|
|
120
|
+
*/
|
|
121
|
+
export declare function multiselect<T>(opts: SelectOpts<T>): Promise<T[]>;
|
|
122
|
+
/**
|
|
123
|
+
* Options for search input.
|
|
124
|
+
*/
|
|
125
|
+
export interface SearchOpts<T> extends BaseOpts<T> {
|
|
126
|
+
/**
|
|
127
|
+
* Every option the user can search through.
|
|
128
|
+
*/
|
|
129
|
+
options: SelectOption<T>[];
|
|
130
|
+
/**
|
|
131
|
+
* Placeholder for the search input.
|
|
132
|
+
*/
|
|
133
|
+
placeholder?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Minimum length for a query string.
|
|
136
|
+
*/
|
|
137
|
+
minQueryLength?: number;
|
|
138
|
+
/**
|
|
139
|
+
* Filters a single option.
|
|
140
|
+
* @param query The search query.
|
|
141
|
+
* @param option The option to filter.
|
|
142
|
+
*/
|
|
143
|
+
filter?(query: string, option: SelectOption<T>): boolean;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Prompts the user to search through a list of options.
|
|
147
|
+
* @param opts Options for search input.
|
|
148
|
+
* @returns The selected option.
|
|
149
|
+
*/
|
|
150
|
+
export declare function search<T>(opts: SearchOpts<T>): Promise<T>;
|
|
151
|
+
/**
|
|
152
|
+
* Options for confirm input.
|
|
153
|
+
*/
|
|
154
|
+
export interface ConfirmOpts extends BaseOpts<boolean> {
|
|
155
|
+
/**
|
|
156
|
+
* What gets displayed for the Yes option.
|
|
157
|
+
*/
|
|
158
|
+
yesLabel?: string;
|
|
159
|
+
/**
|
|
160
|
+
* What gets displayed for the No option.
|
|
161
|
+
*/
|
|
162
|
+
noLabel?: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Prompts the user to confirm an action.
|
|
166
|
+
* @param opts Options for confirm input.
|
|
167
|
+
* @returns If the user picked Yes.
|
|
168
|
+
*/
|
|
169
|
+
export declare function confirm(opts: ConfirmOpts): Promise<boolean>;
|
|
170
|
+
/**
|
|
171
|
+
* Options for opening the system editor.
|
|
172
|
+
*/
|
|
173
|
+
export interface EditorOpts extends BaseOpts<string> {
|
|
174
|
+
/**
|
|
175
|
+
* The initial value.
|
|
176
|
+
*/
|
|
177
|
+
initial?: string;
|
|
178
|
+
/**
|
|
179
|
+
* The language of the value.
|
|
180
|
+
*/
|
|
181
|
+
language?: string;
|
|
182
|
+
/**
|
|
183
|
+
* If the input is required for continuing or not.
|
|
184
|
+
*/
|
|
185
|
+
required?: boolean;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Opens the system editor, or asks for input in the terminal as fallback.
|
|
189
|
+
* @param opts Options for opening the system editor.
|
|
190
|
+
* @returns The result of the system editor.
|
|
191
|
+
*/
|
|
192
|
+
export declare function editor(opts: EditorOpts): Promise<string>;
|
|
193
|
+
export { raw };
|