-
Notifications
You must be signed in to change notification settings - Fork 1
/
prompts.ts
52 lines (48 loc) · 1.14 KB
/
prompts.ts
1
2
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
import "auto";
export default auto({
id: "prompts",
title: "Auto prompts",
params: {
boolean: {
title: "Boolean param",
type: "boolean",
},
number: {
title: "Number param",
type: "number",
},
string: {
title: "String param",
type: "string",
},
},
run: async ({ params }) => {
console.log("Params:", params);
const boolean = await prompt.confirm({ message: "On-demand boolean prompt" });
console.log("Boolean value:", boolean);
const string = await prompt.input({ message: "On-demand string prompt" });
console.log("String value:", string);
const choice = await prompt.select({
message: "Choose",
choices: [
{
name: "Blue pill",
value: "blue",
description: "Take the blue pill",
},
{
name: "Red pill",
value: "red",
description: "Take the red pill",
},
new prompt.Separator(),
{
name: "Green pill",
value: "green",
description: "Take the green pill",
},
],
});
console.log("Choice:", choice);
},
});