@topcli/prompts 1.8.1 → 1.10.0
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/README.md +60 -23
- package/dist/index.cjs +306 -193
- package/dist/index.d.cts +25 -16
- package/dist/index.d.ts +25 -16
- package/dist/index.js +306 -193
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -30,48 +30,57 @@ declare class PromptAgent<T = string> {
|
|
|
30
30
|
nextAnswer(value: T): void;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
type Stdin = NodeJS.ReadStream & {
|
|
34
|
+
fd: 0;
|
|
35
|
+
};
|
|
36
|
+
type Stdout = NodeJS.WriteStream & {
|
|
37
|
+
fd: 1;
|
|
38
|
+
};
|
|
39
|
+
interface AbstractPromptOptions {
|
|
40
|
+
stdin?: Stdin;
|
|
41
|
+
stdout?: Stdout;
|
|
42
|
+
message: string;
|
|
43
|
+
signal?: AbortSignal;
|
|
40
44
|
}
|
|
45
|
+
|
|
41
46
|
interface Choice<T = any> {
|
|
42
47
|
value: T;
|
|
43
48
|
label: string;
|
|
44
49
|
description?: string;
|
|
45
50
|
}
|
|
46
51
|
|
|
47
|
-
interface QuestionOptions extends
|
|
52
|
+
interface QuestionOptions extends AbstractPromptOptions {
|
|
48
53
|
defaultValue?: string;
|
|
49
54
|
validators?: PromptValidator[];
|
|
50
55
|
secure?: boolean;
|
|
51
56
|
}
|
|
52
57
|
|
|
53
|
-
interface ConfirmOptions extends
|
|
58
|
+
interface ConfirmOptions extends AbstractPromptOptions {
|
|
54
59
|
initial?: boolean;
|
|
55
60
|
}
|
|
56
61
|
|
|
57
|
-
interface MultiselectOptions extends
|
|
62
|
+
interface MultiselectOptions extends AbstractPromptOptions {
|
|
58
63
|
choices: (Choice | string)[];
|
|
59
64
|
maxVisible?: number;
|
|
60
65
|
preSelectedChoices?: (Choice | string)[];
|
|
61
66
|
validators?: PromptValidator[];
|
|
62
67
|
autocomplete?: boolean;
|
|
63
68
|
caseSensitive?: boolean;
|
|
69
|
+
showHint?: boolean;
|
|
64
70
|
}
|
|
65
71
|
|
|
66
|
-
interface SelectOptions extends
|
|
72
|
+
interface SelectOptions extends AbstractPromptOptions {
|
|
67
73
|
choices: (Choice | string)[];
|
|
68
74
|
maxVisible?: number;
|
|
69
75
|
ignoreValues?: (string | number | boolean)[];
|
|
76
|
+
validators?: PromptValidator[];
|
|
77
|
+
autocomplete?: boolean;
|
|
78
|
+
caseSensitive?: boolean;
|
|
70
79
|
}
|
|
71
80
|
|
|
72
|
-
declare function question(message: string, options?: QuestionOptions): Promise<string>;
|
|
73
|
-
declare function select(message: string, options: SelectOptions): Promise<string>;
|
|
74
|
-
declare function confirm(message: string, options: ConfirmOptions): Promise<boolean>;
|
|
75
|
-
declare function multiselect(message: string, options: MultiselectOptions): Promise<string[]>;
|
|
81
|
+
declare function question(message: string, options?: Omit<QuestionOptions, "message">): Promise<string>;
|
|
82
|
+
declare function select(message: string, options: Omit<SelectOptions, "message">): Promise<string>;
|
|
83
|
+
declare function confirm(message: string, options: Omit<ConfirmOptions, "message">): Promise<boolean>;
|
|
84
|
+
declare function multiselect(message: string, options: Omit<MultiselectOptions, "message">): Promise<string[]>;
|
|
76
85
|
|
|
77
|
-
export { type Choice, type ConfirmOptions, type MultiselectOptions, PromptAgent, type PromptValidator, type QuestionOptions, type SelectOptions,
|
|
86
|
+
export { type AbstractPromptOptions, type Choice, type ConfirmOptions, type MultiselectOptions, PromptAgent, type PromptValidator, type QuestionOptions, type SelectOptions, confirm, multiselect, question, required, select };
|
package/dist/index.d.ts
CHANGED
|
@@ -30,48 +30,57 @@ declare class PromptAgent<T = string> {
|
|
|
30
30
|
nextAnswer(value: T): void;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
type Stdin = NodeJS.ReadStream & {
|
|
34
|
+
fd: 0;
|
|
35
|
+
};
|
|
36
|
+
type Stdout = NodeJS.WriteStream & {
|
|
37
|
+
fd: 1;
|
|
38
|
+
};
|
|
39
|
+
interface AbstractPromptOptions {
|
|
40
|
+
stdin?: Stdin;
|
|
41
|
+
stdout?: Stdout;
|
|
42
|
+
message: string;
|
|
43
|
+
signal?: AbortSignal;
|
|
40
44
|
}
|
|
45
|
+
|
|
41
46
|
interface Choice<T = any> {
|
|
42
47
|
value: T;
|
|
43
48
|
label: string;
|
|
44
49
|
description?: string;
|
|
45
50
|
}
|
|
46
51
|
|
|
47
|
-
interface QuestionOptions extends
|
|
52
|
+
interface QuestionOptions extends AbstractPromptOptions {
|
|
48
53
|
defaultValue?: string;
|
|
49
54
|
validators?: PromptValidator[];
|
|
50
55
|
secure?: boolean;
|
|
51
56
|
}
|
|
52
57
|
|
|
53
|
-
interface ConfirmOptions extends
|
|
58
|
+
interface ConfirmOptions extends AbstractPromptOptions {
|
|
54
59
|
initial?: boolean;
|
|
55
60
|
}
|
|
56
61
|
|
|
57
|
-
interface MultiselectOptions extends
|
|
62
|
+
interface MultiselectOptions extends AbstractPromptOptions {
|
|
58
63
|
choices: (Choice | string)[];
|
|
59
64
|
maxVisible?: number;
|
|
60
65
|
preSelectedChoices?: (Choice | string)[];
|
|
61
66
|
validators?: PromptValidator[];
|
|
62
67
|
autocomplete?: boolean;
|
|
63
68
|
caseSensitive?: boolean;
|
|
69
|
+
showHint?: boolean;
|
|
64
70
|
}
|
|
65
71
|
|
|
66
|
-
interface SelectOptions extends
|
|
72
|
+
interface SelectOptions extends AbstractPromptOptions {
|
|
67
73
|
choices: (Choice | string)[];
|
|
68
74
|
maxVisible?: number;
|
|
69
75
|
ignoreValues?: (string | number | boolean)[];
|
|
76
|
+
validators?: PromptValidator[];
|
|
77
|
+
autocomplete?: boolean;
|
|
78
|
+
caseSensitive?: boolean;
|
|
70
79
|
}
|
|
71
80
|
|
|
72
|
-
declare function question(message: string, options?: QuestionOptions): Promise<string>;
|
|
73
|
-
declare function select(message: string, options: SelectOptions): Promise<string>;
|
|
74
|
-
declare function confirm(message: string, options: ConfirmOptions): Promise<boolean>;
|
|
75
|
-
declare function multiselect(message: string, options: MultiselectOptions): Promise<string[]>;
|
|
81
|
+
declare function question(message: string, options?: Omit<QuestionOptions, "message">): Promise<string>;
|
|
82
|
+
declare function select(message: string, options: Omit<SelectOptions, "message">): Promise<string>;
|
|
83
|
+
declare function confirm(message: string, options: Omit<ConfirmOptions, "message">): Promise<boolean>;
|
|
84
|
+
declare function multiselect(message: string, options: Omit<MultiselectOptions, "message">): Promise<string[]>;
|
|
76
85
|
|
|
77
|
-
export { type Choice, type ConfirmOptions, type MultiselectOptions, PromptAgent, type PromptValidator, type QuestionOptions, type SelectOptions,
|
|
86
|
+
export { type AbstractPromptOptions, type Choice, type ConfirmOptions, type MultiselectOptions, PromptAgent, type PromptValidator, type QuestionOptions, type SelectOptions, confirm, multiselect, question, required, select };
|