@reliverse/rempts-core 1.6.1
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/LICENSE +21 -0
- package/README.md +102 -0
- package/bin/core-impl/anykey/anykey-mod.d.ts +12 -0
- package/bin/core-impl/anykey/anykey-mod.js +125 -0
- package/bin/core-impl/date/date.d.ts +2 -0
- package/bin/core-impl/date/date.js +236 -0
- package/bin/core-impl/editor/editor-mod.d.ts +25 -0
- package/bin/core-impl/editor/editor-mod.js +896 -0
- package/bin/core-impl/figures/figures-mod.d.ts +233 -0
- package/bin/core-impl/figures/figures-mod.js +286 -0
- package/bin/core-impl/figures/figures.test.d.ts +1 -0
- package/bin/core-impl/figures/figures.test.js +474 -0
- package/bin/core-impl/input/confirm-prompt.d.ts +5 -0
- package/bin/core-impl/input/confirm-prompt.js +173 -0
- package/bin/core-impl/input/input-prompt.d.ts +16 -0
- package/bin/core-impl/input/input-prompt.js +370 -0
- package/bin/core-impl/launcher/_parser.d.ts +2 -0
- package/bin/core-impl/launcher/_parser.js +122 -0
- package/bin/core-impl/launcher/_utils.d.ts +8 -0
- package/bin/core-impl/launcher/_utils.js +29 -0
- package/bin/core-impl/launcher/args.d.ts +3 -0
- package/bin/core-impl/launcher/args.js +89 -0
- package/bin/core-impl/launcher/command.d.ts +8 -0
- package/bin/core-impl/launcher/command.js +68 -0
- package/bin/core-impl/launcher/launcher-mod.d.ts +8 -0
- package/bin/core-impl/launcher/launcher-mod.js +34 -0
- package/bin/core-impl/launcher/usage.d.ts +3 -0
- package/bin/core-impl/launcher/usage.js +104 -0
- package/bin/core-impl/msg-fmt/colors.d.ts +30 -0
- package/bin/core-impl/msg-fmt/colors.js +42 -0
- package/bin/core-impl/msg-fmt/logger.d.ts +17 -0
- package/bin/core-impl/msg-fmt/logger.js +106 -0
- package/bin/core-impl/msg-fmt/mapping.d.ts +3 -0
- package/bin/core-impl/msg-fmt/mapping.js +49 -0
- package/bin/core-impl/msg-fmt/messages.d.ts +35 -0
- package/bin/core-impl/msg-fmt/messages.js +314 -0
- package/bin/core-impl/msg-fmt/terminal.d.ts +15 -0
- package/bin/core-impl/msg-fmt/terminal.js +59 -0
- package/bin/core-impl/msg-fmt/variants.d.ts +11 -0
- package/bin/core-impl/msg-fmt/variants.js +52 -0
- package/bin/core-impl/next-steps/next-steps.d.ts +14 -0
- package/bin/core-impl/next-steps/next-steps.js +24 -0
- package/bin/core-impl/number/number-mod.d.ts +28 -0
- package/bin/core-impl/number/number-mod.js +197 -0
- package/bin/core-impl/results/results.d.ts +7 -0
- package/bin/core-impl/results/results.js +27 -0
- package/bin/core-impl/select/multiselect-prompt.d.ts +2 -0
- package/bin/core-impl/select/multiselect-prompt.js +341 -0
- package/bin/core-impl/select/nummultiselect-prompt.d.ts +6 -0
- package/bin/core-impl/select/nummultiselect-prompt.js +105 -0
- package/bin/core-impl/select/numselect-prompt.d.ts +7 -0
- package/bin/core-impl/select/numselect-prompt.js +115 -0
- package/bin/core-impl/select/select-prompt.d.ts +33 -0
- package/bin/core-impl/select/select-prompt.js +302 -0
- package/bin/core-impl/select/toggle-prompt.d.ts +5 -0
- package/bin/core-impl/select/toggle-prompt.js +208 -0
- package/bin/core-impl/st-end/end.d.ts +2 -0
- package/bin/core-impl/st-end/end.js +42 -0
- package/bin/core-impl/st-end/start.d.ts +17 -0
- package/bin/core-impl/st-end/start.js +66 -0
- package/bin/core-impl/task/progress.d.ts +2 -0
- package/bin/core-impl/task/progress.js +57 -0
- package/bin/core-impl/task/spinner.d.ts +15 -0
- package/bin/core-impl/task/spinner.js +110 -0
- package/bin/core-impl/utils/colorize.d.ts +2 -0
- package/bin/core-impl/utils/colorize.js +134 -0
- package/bin/core-impl/utils/errors.d.ts +1 -0
- package/bin/core-impl/utils/errors.js +15 -0
- package/bin/core-impl/utils/prevent.d.ts +10 -0
- package/bin/core-impl/utils/prevent.js +69 -0
- package/bin/core-impl/utils/prompt-end.d.ts +8 -0
- package/bin/core-impl/utils/prompt-end.js +33 -0
- package/bin/core-impl/utils/stream-text.d.ts +18 -0
- package/bin/core-impl/utils/stream-text.js +136 -0
- package/bin/core-impl/utils/system.d.ts +6 -0
- package/bin/core-impl/utils/system.js +7 -0
- package/bin/core-impl/utils/validate.d.ts +22 -0
- package/bin/core-impl/utils/validate.js +17 -0
- package/bin/core-impl/visual/animate/animate.d.ts +14 -0
- package/bin/core-impl/visual/animate/animate.js +64 -0
- package/bin/core-impl/visual/ascii-art/ascii-art.d.ts +6 -0
- package/bin/core-impl/visual/ascii-art/ascii-art.js +12 -0
- package/bin/core-types.d.ts +434 -0
- package/bin/core-types.js +0 -0
- package/bin/main.d.ts +41 -0
- package/bin/main.js +96 -0
- package/package.json +58 -0
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { vi, it, expect, afterAll } from "vitest";
|
|
2
|
+
afterAll(() => {
|
|
3
|
+
vi.unstubAllEnvs();
|
|
4
|
+
});
|
|
5
|
+
it("falls back to ascii figures when unicode is not supported", async () => {
|
|
6
|
+
const { default: unicodeFigures } = await import("./figures-mod.js");
|
|
7
|
+
vi.resetModules().stubEnv("TERM", "linux");
|
|
8
|
+
const { default: asciiFigures } = await import("./figures-mod.js");
|
|
9
|
+
expect(asciiFigures.checkboxOn).not.toEqual(unicodeFigures.checkboxOn);
|
|
10
|
+
expect(unicodeFigures).toMatchInlineSnapshot(`
|
|
11
|
+
{
|
|
12
|
+
"almostEqual": "\u2248",
|
|
13
|
+
"arrowDown": "\u2193",
|
|
14
|
+
"arrowLeft": "\u2190",
|
|
15
|
+
"arrowLeftRight": "\u2194",
|
|
16
|
+
"arrowRight": "\u2192",
|
|
17
|
+
"arrowUp": "\u2191",
|
|
18
|
+
"arrowUpDown": "\u2195",
|
|
19
|
+
"bullet": "\u25CF",
|
|
20
|
+
"checkboxCircleOff": "\u24BE",
|
|
21
|
+
"checkboxCircleOn": "\u24E7",
|
|
22
|
+
"checkboxOff": "\u2610",
|
|
23
|
+
"checkboxOn": "\u2612",
|
|
24
|
+
"circle": "\u25EF",
|
|
25
|
+
"circleCircle": "\u24DE",
|
|
26
|
+
"circleCross": "\u24E7",
|
|
27
|
+
"circleDotted": "\u25CC",
|
|
28
|
+
"circleDouble": "\u25CE",
|
|
29
|
+
"circleFilled": "\u25C9",
|
|
30
|
+
"circlePipe": "\u24BE",
|
|
31
|
+
"circleQuestionMark": "(?)",
|
|
32
|
+
"cross": "\u2718",
|
|
33
|
+
"dot": "\u2024",
|
|
34
|
+
"ellipsis": "\u2026",
|
|
35
|
+
"fiveEighths": "\u215D",
|
|
36
|
+
"fiveSixths": "\u215A",
|
|
37
|
+
"fourFifths": "\u2158",
|
|
38
|
+
"greaterOrEqual": "\u2265",
|
|
39
|
+
"hamburger": "\u2630",
|
|
40
|
+
"heart": "\u2665",
|
|
41
|
+
"home": "\u2302",
|
|
42
|
+
"identical": "\u2261",
|
|
43
|
+
"infinity": "\u221E",
|
|
44
|
+
"info": "\u2139",
|
|
45
|
+
"lessOrEqual": "\u2264",
|
|
46
|
+
"line": "\u2500",
|
|
47
|
+
"lineBackslash": "\u2572",
|
|
48
|
+
"lineBold": "\u2501",
|
|
49
|
+
"lineCross": "\u2573",
|
|
50
|
+
"lineDashed0": "\u2504",
|
|
51
|
+
"lineDashed1": "\u2505",
|
|
52
|
+
"lineDashed10": "\u257C",
|
|
53
|
+
"lineDashed11": "\u257E",
|
|
54
|
+
"lineDashed12": "\u2212",
|
|
55
|
+
"lineDashed13": "\u2013",
|
|
56
|
+
"lineDashed14": "\u2010",
|
|
57
|
+
"lineDashed15": "\u2043",
|
|
58
|
+
"lineDashed2": "\u2508",
|
|
59
|
+
"lineDashed3": "\u2509",
|
|
60
|
+
"lineDashed4": "\u254C",
|
|
61
|
+
"lineDashed5": "\u254D",
|
|
62
|
+
"lineDashed6": "\u2574",
|
|
63
|
+
"lineDashed7": "\u2576",
|
|
64
|
+
"lineDashed8": "\u2578",
|
|
65
|
+
"lineDashed9": "\u257A",
|
|
66
|
+
"lineDouble": "\u2550",
|
|
67
|
+
"lineDownBoldLeft": "\u2512",
|
|
68
|
+
"lineDownBoldLeftBold": "\u2513",
|
|
69
|
+
"lineDownBoldLeftBoldRight": "\u2531",
|
|
70
|
+
"lineDownBoldLeftBoldRightBold": "\u2533",
|
|
71
|
+
"lineDownBoldLeftRight": "\u2530",
|
|
72
|
+
"lineDownBoldLeftRightBold": "\u2532",
|
|
73
|
+
"lineDownBoldRight": "\u250E",
|
|
74
|
+
"lineDownBoldRightBold": "\u250F",
|
|
75
|
+
"lineDownDoubleLeft": "\u2556",
|
|
76
|
+
"lineDownDoubleLeftDouble": "\u2557",
|
|
77
|
+
"lineDownDoubleLeftDoubleRightDouble": "\u2566",
|
|
78
|
+
"lineDownDoubleLeftRight": "\u2565",
|
|
79
|
+
"lineDownDoubleRight": "\u2553",
|
|
80
|
+
"lineDownDoubleRightDouble": "\u2554",
|
|
81
|
+
"lineDownLeft": "\u2510",
|
|
82
|
+
"lineDownLeftArc": "\u256E",
|
|
83
|
+
"lineDownLeftBold": "\u2511",
|
|
84
|
+
"lineDownLeftBoldRight": "\u252D",
|
|
85
|
+
"lineDownLeftBoldRightBold": "\u252F",
|
|
86
|
+
"lineDownLeftDouble": "\u2555",
|
|
87
|
+
"lineDownLeftDoubleRightDouble": "\u2564",
|
|
88
|
+
"lineDownLeftRight": "\u252C",
|
|
89
|
+
"lineDownLeftRightBold": "\u252E",
|
|
90
|
+
"lineDownRight": "\u250C",
|
|
91
|
+
"lineDownRightArc": "\u256D",
|
|
92
|
+
"lineDownRightBold": "\u250D",
|
|
93
|
+
"lineDownRightDouble": "\u2552",
|
|
94
|
+
"lineSlash": "\u2571",
|
|
95
|
+
"lineUpBoldDownBoldLeft": "\u2528",
|
|
96
|
+
"lineUpBoldDownBoldLeftBold": "\u252B",
|
|
97
|
+
"lineUpBoldDownBoldLeftBoldRight": "\u2549",
|
|
98
|
+
"lineUpBoldDownBoldLeftBoldRightBold": "\u254B",
|
|
99
|
+
"lineUpBoldDownBoldLeftRight": "\u2542",
|
|
100
|
+
"lineUpBoldDownBoldLeftRightBold": "\u254A",
|
|
101
|
+
"lineUpBoldDownBoldRight": "\u2520",
|
|
102
|
+
"lineUpBoldDownBoldRightBold": "\u2523",
|
|
103
|
+
"lineUpBoldDownLeft": "\u2526",
|
|
104
|
+
"lineUpBoldDownLeftBold": "\u2529",
|
|
105
|
+
"lineUpBoldDownLeftBoldRight": "\u2543",
|
|
106
|
+
"lineUpBoldDownLeftBoldRightBold": "\u2547",
|
|
107
|
+
"lineUpBoldDownLeftRight": "\u2540",
|
|
108
|
+
"lineUpBoldDownLeftRightBold": "\u2544",
|
|
109
|
+
"lineUpBoldDownRight": "\u251E",
|
|
110
|
+
"lineUpBoldDownRightBold": "\u2521",
|
|
111
|
+
"lineUpBoldLeft": "\u251A",
|
|
112
|
+
"lineUpBoldLeftBold": "\u251B",
|
|
113
|
+
"lineUpBoldLeftBoldRight": "\u2539",
|
|
114
|
+
"lineUpBoldLeftBoldRightBold": "\u253B",
|
|
115
|
+
"lineUpBoldLeftRight": "\u2538",
|
|
116
|
+
"lineUpBoldLeftRightBold": "\u253A",
|
|
117
|
+
"lineUpBoldRight": "\u2516",
|
|
118
|
+
"lineUpBoldRightBold": "\u2517",
|
|
119
|
+
"lineUpDoubleDownDoubleLeft": "\u2562",
|
|
120
|
+
"lineUpDoubleDownDoubleLeftDouble": "\u2563",
|
|
121
|
+
"lineUpDoubleDownDoubleLeftDoubleRightDouble": "\u256C",
|
|
122
|
+
"lineUpDoubleDownDoubleLeftRight": "\u256B",
|
|
123
|
+
"lineUpDoubleDownDoubleRight": "\u255F",
|
|
124
|
+
"lineUpDoubleDownDoubleRightDouble": "\u2560",
|
|
125
|
+
"lineUpDoubleLeft": "\u255C",
|
|
126
|
+
"lineUpDoubleLeftDouble": "\u255D",
|
|
127
|
+
"lineUpDoubleLeftDoubleRightDouble": "\u2569",
|
|
128
|
+
"lineUpDoubleLeftRight": "\u2568",
|
|
129
|
+
"lineUpDoubleRight": "\u2559",
|
|
130
|
+
"lineUpDoubleRightDouble": "\u255A",
|
|
131
|
+
"lineUpDownBoldLeft": "\u2527",
|
|
132
|
+
"lineUpDownBoldLeftBold": "\u252A",
|
|
133
|
+
"lineUpDownBoldLeftBoldRight": "\u2545",
|
|
134
|
+
"lineUpDownBoldLeftBoldRightBold": "\u2548",
|
|
135
|
+
"lineUpDownBoldLeftRight": "\u2541",
|
|
136
|
+
"lineUpDownBoldLeftRightBold": "\u2546",
|
|
137
|
+
"lineUpDownBoldRight": "\u251F",
|
|
138
|
+
"lineUpDownBoldRightBold": "\u2522",
|
|
139
|
+
"lineUpDownLeft": "\u2524",
|
|
140
|
+
"lineUpDownLeftBold": "\u2525",
|
|
141
|
+
"lineUpDownLeftBoldRight": "\u253D",
|
|
142
|
+
"lineUpDownLeftBoldRightBold": "\u253F",
|
|
143
|
+
"lineUpDownLeftDouble": "\u2561",
|
|
144
|
+
"lineUpDownLeftDoubleRightDouble": "\u256A",
|
|
145
|
+
"lineUpDownLeftRight": "\u253C",
|
|
146
|
+
"lineUpDownLeftRightBold": "\u253E",
|
|
147
|
+
"lineUpDownRight": "\u251C",
|
|
148
|
+
"lineUpDownRightBold": "\u251D",
|
|
149
|
+
"lineUpDownRightDouble": "\u255E",
|
|
150
|
+
"lineUpLeft": "\u2518",
|
|
151
|
+
"lineUpLeftArc": "\u256F",
|
|
152
|
+
"lineUpLeftBold": "\u2519",
|
|
153
|
+
"lineUpLeftBoldRight": "\u2535",
|
|
154
|
+
"lineUpLeftBoldRightBold": "\u2537",
|
|
155
|
+
"lineUpLeftDouble": "\u255B",
|
|
156
|
+
"lineUpLeftDoubleRightDouble": "\u2567",
|
|
157
|
+
"lineUpLeftRight": "\u2534",
|
|
158
|
+
"lineUpLeftRightBold": "\u2536",
|
|
159
|
+
"lineUpRight": "\u2514",
|
|
160
|
+
"lineUpRightArc": "\u2570",
|
|
161
|
+
"lineUpRightBold": "\u2515",
|
|
162
|
+
"lineUpRightDouble": "\u2558",
|
|
163
|
+
"lineVertical": "\u2502",
|
|
164
|
+
"lineVerticalBold": "\u2503",
|
|
165
|
+
"lineVerticalDashed0": "\u2506",
|
|
166
|
+
"lineVerticalDashed1": "\u2507",
|
|
167
|
+
"lineVerticalDashed10": "\u257D",
|
|
168
|
+
"lineVerticalDashed11": "\u257F",
|
|
169
|
+
"lineVerticalDashed2": "\u250A",
|
|
170
|
+
"lineVerticalDashed3": "\u250B",
|
|
171
|
+
"lineVerticalDashed4": "\u254E",
|
|
172
|
+
"lineVerticalDashed5": "\u254F",
|
|
173
|
+
"lineVerticalDashed6": "\u2575",
|
|
174
|
+
"lineVerticalDashed7": "\u2577",
|
|
175
|
+
"lineVerticalDashed8": "\u2579",
|
|
176
|
+
"lineVerticalDashed9": "\u257B",
|
|
177
|
+
"lineVerticalDouble": "\u2551",
|
|
178
|
+
"lozenge": "\u25C6",
|
|
179
|
+
"lozengeOutline": "\u25C7",
|
|
180
|
+
"musicNote": "\u266A",
|
|
181
|
+
"musicNoteBeamed": "\u266B",
|
|
182
|
+
"mustache": "\u0DF4",
|
|
183
|
+
"nodejs": "\u2B22",
|
|
184
|
+
"notEqual": "\u2260",
|
|
185
|
+
"oneEighth": "\u215B",
|
|
186
|
+
"oneFifth": "\u2155",
|
|
187
|
+
"oneHalf": "\xBD",
|
|
188
|
+
"oneNinth": "\u2151",
|
|
189
|
+
"oneQuarter": "\xBC",
|
|
190
|
+
"oneSeventh": "\u2150",
|
|
191
|
+
"oneSixth": "\u2159",
|
|
192
|
+
"oneTenth": "\u2152",
|
|
193
|
+
"oneThird": "\u2153",
|
|
194
|
+
"play": "\u25B6",
|
|
195
|
+
"pointer": "\u276F",
|
|
196
|
+
"pointerSmall": "\u203A",
|
|
197
|
+
"questionMarkPrefix": "(?)",
|
|
198
|
+
"radioOff": "\u25EF",
|
|
199
|
+
"radioOn": "\u25C9",
|
|
200
|
+
"sevenEighths": "\u215E",
|
|
201
|
+
"smiley": "\u32E1",
|
|
202
|
+
"square": "\u2588",
|
|
203
|
+
"squareBottom": "\u2584",
|
|
204
|
+
"squareCenter": "\u25A0",
|
|
205
|
+
"squareDarkShade": "\u2593",
|
|
206
|
+
"squareLeft": "\u258C",
|
|
207
|
+
"squareLightShade": "\u2591",
|
|
208
|
+
"squareMediumShade": "\u2592",
|
|
209
|
+
"squareRight": "\u2590",
|
|
210
|
+
"squareSmall": "\u25FB",
|
|
211
|
+
"squareSmallFilled": "\u25FC",
|
|
212
|
+
"squareTop": "\u2580",
|
|
213
|
+
"star": "\u2605",
|
|
214
|
+
"subscriptEight": "\u2088",
|
|
215
|
+
"subscriptFive": "\u2085",
|
|
216
|
+
"subscriptFour": "\u2084",
|
|
217
|
+
"subscriptNine": "\u2089",
|
|
218
|
+
"subscriptOne": "\u2081",
|
|
219
|
+
"subscriptSeven": "\u2087",
|
|
220
|
+
"subscriptSix": "\u2086",
|
|
221
|
+
"subscriptThree": "\u2083",
|
|
222
|
+
"subscriptTwo": "\u2082",
|
|
223
|
+
"subscriptZero": "\u2080",
|
|
224
|
+
"threeEighths": "\u215C",
|
|
225
|
+
"threeFifths": "\u2157",
|
|
226
|
+
"threeQuarters": "\xBE",
|
|
227
|
+
"tick": "\u2714",
|
|
228
|
+
"triangleDown": "\u25BC",
|
|
229
|
+
"triangleDownSmall": "\u25BE",
|
|
230
|
+
"triangleLeft": "\u25C0",
|
|
231
|
+
"triangleLeftSmall": "\u25C2",
|
|
232
|
+
"triangleRight": "\u25B6",
|
|
233
|
+
"triangleRightSmall": "\u25B8",
|
|
234
|
+
"triangleUp": "\u25B2",
|
|
235
|
+
"triangleUpOutline": "\u25B3",
|
|
236
|
+
"triangleUpSmall": "\u25B4",
|
|
237
|
+
"twoFifths": "\u2156",
|
|
238
|
+
"twoThirds": "\u2154",
|
|
239
|
+
"warning": "\u26A0",
|
|
240
|
+
}
|
|
241
|
+
`);
|
|
242
|
+
expect(asciiFigures).toMatchInlineSnapshot(`
|
|
243
|
+
{
|
|
244
|
+
"almostEqual": "\u2248",
|
|
245
|
+
"arrowDown": "\u2193",
|
|
246
|
+
"arrowLeft": "\u2190",
|
|
247
|
+
"arrowLeftRight": "\u2194",
|
|
248
|
+
"arrowRight": "\u2192",
|
|
249
|
+
"arrowUp": "\u2191",
|
|
250
|
+
"arrowUpDown": "\u2195",
|
|
251
|
+
"bullet": "\u25CF",
|
|
252
|
+
"checkboxCircleOff": "( )",
|
|
253
|
+
"checkboxCircleOn": "(\xD7)",
|
|
254
|
+
"checkboxOff": "[ ]",
|
|
255
|
+
"checkboxOn": "[\xD7]",
|
|
256
|
+
"circle": "( )",
|
|
257
|
+
"circleCircle": "(\u25CB)",
|
|
258
|
+
"circleCross": "(\xD7)",
|
|
259
|
+
"circleDotted": "( )",
|
|
260
|
+
"circleDouble": "( )",
|
|
261
|
+
"circleFilled": "(*)",
|
|
262
|
+
"circlePipe": "(\u2502)",
|
|
263
|
+
"circleQuestionMark": "(?)",
|
|
264
|
+
"cross": "\xD7",
|
|
265
|
+
"dot": "\u2024",
|
|
266
|
+
"ellipsis": "\u2026",
|
|
267
|
+
"fiveEighths": "\u215D",
|
|
268
|
+
"fiveSixths": "\u215A",
|
|
269
|
+
"fourFifths": "\u2158",
|
|
270
|
+
"greaterOrEqual": "\u2265",
|
|
271
|
+
"hamburger": "\u2261",
|
|
272
|
+
"heart": "\u2665",
|
|
273
|
+
"home": "\u2302",
|
|
274
|
+
"identical": "\u2261",
|
|
275
|
+
"infinity": "\u221E",
|
|
276
|
+
"info": "i",
|
|
277
|
+
"lessOrEqual": "\u2264",
|
|
278
|
+
"line": "\u2500",
|
|
279
|
+
"lineBackslash": "\u2572",
|
|
280
|
+
"lineBold": "\u2501",
|
|
281
|
+
"lineCross": "\u2573",
|
|
282
|
+
"lineDashed0": "\u2504",
|
|
283
|
+
"lineDashed1": "\u2505",
|
|
284
|
+
"lineDashed10": "\u257C",
|
|
285
|
+
"lineDashed11": "\u257E",
|
|
286
|
+
"lineDashed12": "\u2212",
|
|
287
|
+
"lineDashed13": "\u2013",
|
|
288
|
+
"lineDashed14": "\u2010",
|
|
289
|
+
"lineDashed15": "\u2043",
|
|
290
|
+
"lineDashed2": "\u2508",
|
|
291
|
+
"lineDashed3": "\u2509",
|
|
292
|
+
"lineDashed4": "\u254C",
|
|
293
|
+
"lineDashed5": "\u254D",
|
|
294
|
+
"lineDashed6": "\u2574",
|
|
295
|
+
"lineDashed7": "\u2576",
|
|
296
|
+
"lineDashed8": "\u2578",
|
|
297
|
+
"lineDashed9": "\u257A",
|
|
298
|
+
"lineDouble": "\u2550",
|
|
299
|
+
"lineDownBoldLeft": "\u2512",
|
|
300
|
+
"lineDownBoldLeftBold": "\u2513",
|
|
301
|
+
"lineDownBoldLeftBoldRight": "\u2531",
|
|
302
|
+
"lineDownBoldLeftBoldRightBold": "\u2533",
|
|
303
|
+
"lineDownBoldLeftRight": "\u2530",
|
|
304
|
+
"lineDownBoldLeftRightBold": "\u2532",
|
|
305
|
+
"lineDownBoldRight": "\u250E",
|
|
306
|
+
"lineDownBoldRightBold": "\u250F",
|
|
307
|
+
"lineDownDoubleLeft": "\u2556",
|
|
308
|
+
"lineDownDoubleLeftDouble": "\u2557",
|
|
309
|
+
"lineDownDoubleLeftDoubleRightDouble": "\u2566",
|
|
310
|
+
"lineDownDoubleLeftRight": "\u2565",
|
|
311
|
+
"lineDownDoubleRight": "\u2553",
|
|
312
|
+
"lineDownDoubleRightDouble": "\u2554",
|
|
313
|
+
"lineDownLeft": "\u2510",
|
|
314
|
+
"lineDownLeftArc": "\u256E",
|
|
315
|
+
"lineDownLeftBold": "\u2511",
|
|
316
|
+
"lineDownLeftBoldRight": "\u252D",
|
|
317
|
+
"lineDownLeftBoldRightBold": "\u252F",
|
|
318
|
+
"lineDownLeftDouble": "\u2555",
|
|
319
|
+
"lineDownLeftDoubleRightDouble": "\u2564",
|
|
320
|
+
"lineDownLeftRight": "\u252C",
|
|
321
|
+
"lineDownLeftRightBold": "\u252E",
|
|
322
|
+
"lineDownRight": "\u250C",
|
|
323
|
+
"lineDownRightArc": "\u256D",
|
|
324
|
+
"lineDownRightBold": "\u250D",
|
|
325
|
+
"lineDownRightDouble": "\u2552",
|
|
326
|
+
"lineSlash": "\u2571",
|
|
327
|
+
"lineUpBoldDownBoldLeft": "\u2528",
|
|
328
|
+
"lineUpBoldDownBoldLeftBold": "\u252B",
|
|
329
|
+
"lineUpBoldDownBoldLeftBoldRight": "\u2549",
|
|
330
|
+
"lineUpBoldDownBoldLeftBoldRightBold": "\u254B",
|
|
331
|
+
"lineUpBoldDownBoldLeftRight": "\u2542",
|
|
332
|
+
"lineUpBoldDownBoldLeftRightBold": "\u254A",
|
|
333
|
+
"lineUpBoldDownBoldRight": "\u2520",
|
|
334
|
+
"lineUpBoldDownBoldRightBold": "\u2523",
|
|
335
|
+
"lineUpBoldDownLeft": "\u2526",
|
|
336
|
+
"lineUpBoldDownLeftBold": "\u2529",
|
|
337
|
+
"lineUpBoldDownLeftBoldRight": "\u2543",
|
|
338
|
+
"lineUpBoldDownLeftBoldRightBold": "\u2547",
|
|
339
|
+
"lineUpBoldDownLeftRight": "\u2540",
|
|
340
|
+
"lineUpBoldDownLeftRightBold": "\u2544",
|
|
341
|
+
"lineUpBoldDownRight": "\u251E",
|
|
342
|
+
"lineUpBoldDownRightBold": "\u2521",
|
|
343
|
+
"lineUpBoldLeft": "\u251A",
|
|
344
|
+
"lineUpBoldLeftBold": "\u251B",
|
|
345
|
+
"lineUpBoldLeftBoldRight": "\u2539",
|
|
346
|
+
"lineUpBoldLeftBoldRightBold": "\u253B",
|
|
347
|
+
"lineUpBoldLeftRight": "\u2538",
|
|
348
|
+
"lineUpBoldLeftRightBold": "\u253A",
|
|
349
|
+
"lineUpBoldRight": "\u2516",
|
|
350
|
+
"lineUpBoldRightBold": "\u2517",
|
|
351
|
+
"lineUpDoubleDownDoubleLeft": "\u2562",
|
|
352
|
+
"lineUpDoubleDownDoubleLeftDouble": "\u2563",
|
|
353
|
+
"lineUpDoubleDownDoubleLeftDoubleRightDouble": "\u256C",
|
|
354
|
+
"lineUpDoubleDownDoubleLeftRight": "\u256B",
|
|
355
|
+
"lineUpDoubleDownDoubleRight": "\u255F",
|
|
356
|
+
"lineUpDoubleDownDoubleRightDouble": "\u2560",
|
|
357
|
+
"lineUpDoubleLeft": "\u255C",
|
|
358
|
+
"lineUpDoubleLeftDouble": "\u255D",
|
|
359
|
+
"lineUpDoubleLeftDoubleRightDouble": "\u2569",
|
|
360
|
+
"lineUpDoubleLeftRight": "\u2568",
|
|
361
|
+
"lineUpDoubleRight": "\u2559",
|
|
362
|
+
"lineUpDoubleRightDouble": "\u255A",
|
|
363
|
+
"lineUpDownBoldLeft": "\u2527",
|
|
364
|
+
"lineUpDownBoldLeftBold": "\u252A",
|
|
365
|
+
"lineUpDownBoldLeftBoldRight": "\u2545",
|
|
366
|
+
"lineUpDownBoldLeftBoldRightBold": "\u2548",
|
|
367
|
+
"lineUpDownBoldLeftRight": "\u2541",
|
|
368
|
+
"lineUpDownBoldLeftRightBold": "\u2546",
|
|
369
|
+
"lineUpDownBoldRight": "\u251F",
|
|
370
|
+
"lineUpDownBoldRightBold": "\u2522",
|
|
371
|
+
"lineUpDownLeft": "\u2524",
|
|
372
|
+
"lineUpDownLeftBold": "\u2525",
|
|
373
|
+
"lineUpDownLeftBoldRight": "\u253D",
|
|
374
|
+
"lineUpDownLeftBoldRightBold": "\u253F",
|
|
375
|
+
"lineUpDownLeftDouble": "\u2561",
|
|
376
|
+
"lineUpDownLeftDoubleRightDouble": "\u256A",
|
|
377
|
+
"lineUpDownLeftRight": "\u253C",
|
|
378
|
+
"lineUpDownLeftRightBold": "\u253E",
|
|
379
|
+
"lineUpDownRight": "\u251C",
|
|
380
|
+
"lineUpDownRightBold": "\u251D",
|
|
381
|
+
"lineUpDownRightDouble": "\u255E",
|
|
382
|
+
"lineUpLeft": "\u2518",
|
|
383
|
+
"lineUpLeftArc": "\u256F",
|
|
384
|
+
"lineUpLeftBold": "\u2519",
|
|
385
|
+
"lineUpLeftBoldRight": "\u2535",
|
|
386
|
+
"lineUpLeftBoldRightBold": "\u2537",
|
|
387
|
+
"lineUpLeftDouble": "\u255B",
|
|
388
|
+
"lineUpLeftDoubleRightDouble": "\u2567",
|
|
389
|
+
"lineUpLeftRight": "\u2534",
|
|
390
|
+
"lineUpLeftRightBold": "\u2536",
|
|
391
|
+
"lineUpRight": "\u2514",
|
|
392
|
+
"lineUpRightArc": "\u2570",
|
|
393
|
+
"lineUpRightBold": "\u2515",
|
|
394
|
+
"lineUpRightDouble": "\u2558",
|
|
395
|
+
"lineVertical": "\u2502",
|
|
396
|
+
"lineVerticalBold": "\u2503",
|
|
397
|
+
"lineVerticalDashed0": "\u2506",
|
|
398
|
+
"lineVerticalDashed1": "\u2507",
|
|
399
|
+
"lineVerticalDashed10": "\u257D",
|
|
400
|
+
"lineVerticalDashed11": "\u257F",
|
|
401
|
+
"lineVerticalDashed2": "\u250A",
|
|
402
|
+
"lineVerticalDashed3": "\u250B",
|
|
403
|
+
"lineVerticalDashed4": "\u254E",
|
|
404
|
+
"lineVerticalDashed5": "\u254F",
|
|
405
|
+
"lineVerticalDashed6": "\u2575",
|
|
406
|
+
"lineVerticalDashed7": "\u2577",
|
|
407
|
+
"lineVerticalDashed8": "\u2579",
|
|
408
|
+
"lineVerticalDashed9": "\u257B",
|
|
409
|
+
"lineVerticalDouble": "\u2551",
|
|
410
|
+
"lozenge": "\u2666",
|
|
411
|
+
"lozengeOutline": "\u25CA",
|
|
412
|
+
"musicNote": "\u266A",
|
|
413
|
+
"musicNoteBeamed": "\u266B",
|
|
414
|
+
"mustache": "\u250C\u2500\u2510",
|
|
415
|
+
"nodejs": "\u2666",
|
|
416
|
+
"notEqual": "\u2260",
|
|
417
|
+
"oneEighth": "\u215B",
|
|
418
|
+
"oneFifth": "\u2155",
|
|
419
|
+
"oneHalf": "\xBD",
|
|
420
|
+
"oneNinth": "1/9",
|
|
421
|
+
"oneQuarter": "\xBC",
|
|
422
|
+
"oneSeventh": "1/7",
|
|
423
|
+
"oneSixth": "\u2159",
|
|
424
|
+
"oneTenth": "1/10",
|
|
425
|
+
"oneThird": "\u2153",
|
|
426
|
+
"play": "\u25BA",
|
|
427
|
+
"pointer": ">",
|
|
428
|
+
"pointerSmall": "\u203A",
|
|
429
|
+
"questionMarkPrefix": "(?)",
|
|
430
|
+
"radioOff": "( )",
|
|
431
|
+
"radioOn": "(*)",
|
|
432
|
+
"sevenEighths": "\u215E",
|
|
433
|
+
"smiley": "\u263A",
|
|
434
|
+
"square": "\u2588",
|
|
435
|
+
"squareBottom": "\u2584",
|
|
436
|
+
"squareCenter": "\u25A0",
|
|
437
|
+
"squareDarkShade": "\u2593",
|
|
438
|
+
"squareLeft": "\u258C",
|
|
439
|
+
"squareLightShade": "\u2591",
|
|
440
|
+
"squareMediumShade": "\u2592",
|
|
441
|
+
"squareRight": "\u2590",
|
|
442
|
+
"squareSmall": "\u25A1",
|
|
443
|
+
"squareSmallFilled": "\u25A0",
|
|
444
|
+
"squareTop": "\u2580",
|
|
445
|
+
"star": "\u2736",
|
|
446
|
+
"subscriptEight": "\u2088",
|
|
447
|
+
"subscriptFive": "\u2085",
|
|
448
|
+
"subscriptFour": "\u2084",
|
|
449
|
+
"subscriptNine": "\u2089",
|
|
450
|
+
"subscriptOne": "\u2081",
|
|
451
|
+
"subscriptSeven": "\u2087",
|
|
452
|
+
"subscriptSix": "\u2086",
|
|
453
|
+
"subscriptThree": "\u2083",
|
|
454
|
+
"subscriptTwo": "\u2082",
|
|
455
|
+
"subscriptZero": "\u2080",
|
|
456
|
+
"threeEighths": "\u215C",
|
|
457
|
+
"threeFifths": "\u2157",
|
|
458
|
+
"threeQuarters": "\xBE",
|
|
459
|
+
"tick": "\u221A",
|
|
460
|
+
"triangleDown": "\u25BC",
|
|
461
|
+
"triangleDownSmall": "\u25BE",
|
|
462
|
+
"triangleLeft": "\u25C4",
|
|
463
|
+
"triangleLeftSmall": "\u25C2",
|
|
464
|
+
"triangleRight": "\u25BA",
|
|
465
|
+
"triangleRightSmall": "\u25B8",
|
|
466
|
+
"triangleUp": "\u25B2",
|
|
467
|
+
"triangleUpOutline": "\u2206",
|
|
468
|
+
"triangleUpSmall": "\u25B4",
|
|
469
|
+
"twoFifths": "\u2156",
|
|
470
|
+
"twoThirds": "\u2154",
|
|
471
|
+
"warning": "\u203C",
|
|
472
|
+
}
|
|
473
|
+
`);
|
|
474
|
+
});
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { colorize, re } from "@reliverse/relico";
|
|
2
|
+
import { stdin as input, stdout as output } from "node:process";
|
|
3
|
+
import readline from "node:readline/promises";
|
|
4
|
+
import { bar, msg } from "../msg-fmt/messages.js";
|
|
5
|
+
import { deleteLastLine } from "../msg-fmt/terminal.js";
|
|
6
|
+
import { completePrompt } from "../utils/prompt-end.js";
|
|
7
|
+
function renderPrompt(params) {
|
|
8
|
+
const {
|
|
9
|
+
title,
|
|
10
|
+
content,
|
|
11
|
+
borderColor,
|
|
12
|
+
titleColor,
|
|
13
|
+
titleTypography,
|
|
14
|
+
titleVariant,
|
|
15
|
+
contentColor,
|
|
16
|
+
contentTypography,
|
|
17
|
+
contentVariant,
|
|
18
|
+
hintPlaceholderColor,
|
|
19
|
+
border,
|
|
20
|
+
variantOptions,
|
|
21
|
+
errorMessage,
|
|
22
|
+
displayInstructions,
|
|
23
|
+
instructions,
|
|
24
|
+
isRerender = false
|
|
25
|
+
} = params;
|
|
26
|
+
let uiLineCount = 0;
|
|
27
|
+
if (!isRerender) {
|
|
28
|
+
msg({
|
|
29
|
+
hintPlaceholderColor,
|
|
30
|
+
type: errorMessage ? "M_ERROR" : "M_GENERAL",
|
|
31
|
+
title,
|
|
32
|
+
titleColor,
|
|
33
|
+
titleTypography,
|
|
34
|
+
...titleVariant ? { titleVariant } : {},
|
|
35
|
+
...content ? {
|
|
36
|
+
content: content.split("\n").map((line) => line.trim()).join("\n")
|
|
37
|
+
} : {},
|
|
38
|
+
contentColor,
|
|
39
|
+
contentTypography,
|
|
40
|
+
...contentVariant ? { contentVariant } : {},
|
|
41
|
+
borderColor,
|
|
42
|
+
variantOptions,
|
|
43
|
+
errorMessage,
|
|
44
|
+
border
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
if (displayInstructions && !isRerender) {
|
|
48
|
+
msg({
|
|
49
|
+
type: "M_NULL",
|
|
50
|
+
title: re.blue(instructions)
|
|
51
|
+
});
|
|
52
|
+
uiLineCount++;
|
|
53
|
+
}
|
|
54
|
+
if (errorMessage) {
|
|
55
|
+
msg({
|
|
56
|
+
type: "M_NULL",
|
|
57
|
+
title: re.redBright(errorMessage)
|
|
58
|
+
});
|
|
59
|
+
uiLineCount++;
|
|
60
|
+
}
|
|
61
|
+
return uiLineCount;
|
|
62
|
+
}
|
|
63
|
+
export async function confirmPrompt(options) {
|
|
64
|
+
const {
|
|
65
|
+
title = "",
|
|
66
|
+
defaultValue,
|
|
67
|
+
titleColor = "cyan",
|
|
68
|
+
titleTypography = "none",
|
|
69
|
+
titleVariant,
|
|
70
|
+
content,
|
|
71
|
+
contentColor = "dim",
|
|
72
|
+
contentTypography = "italic",
|
|
73
|
+
contentVariant,
|
|
74
|
+
borderColor = "dim",
|
|
75
|
+
hintPlaceholderColor = "blue",
|
|
76
|
+
variantOptions,
|
|
77
|
+
action,
|
|
78
|
+
displayInstructions = false,
|
|
79
|
+
endTitle = "",
|
|
80
|
+
endTitleColor = "dim",
|
|
81
|
+
border = true
|
|
82
|
+
} = options;
|
|
83
|
+
const rl = readline.createInterface({ input, output });
|
|
84
|
+
let errorMessage = "";
|
|
85
|
+
const effectiveDefault = defaultValue ?? true;
|
|
86
|
+
const defaultHint = effectiveDefault ? "[Y/n]" : "[y/N]";
|
|
87
|
+
const adjustedTitle = displayInstructions ? title : `${re.blue(defaultHint)} ${title}`;
|
|
88
|
+
const instructions = `Use <y/n> to confirm or deny, <Enter> for default (${effectiveDefault ? "Y" : "N"}), <Ctrl+C> to exit`;
|
|
89
|
+
let lastUILineCount = 0;
|
|
90
|
+
function endPrompt(isCtrlC = false) {
|
|
91
|
+
if (endTitle !== "") {
|
|
92
|
+
msg({
|
|
93
|
+
type: "M_END",
|
|
94
|
+
title: endTitle,
|
|
95
|
+
titleColor: endTitleColor,
|
|
96
|
+
titleTypography,
|
|
97
|
+
...titleVariant ? { titleVariant } : {},
|
|
98
|
+
border,
|
|
99
|
+
borderColor
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
rl.close();
|
|
103
|
+
if (isCtrlC) {
|
|
104
|
+
process.exit(0);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
rl.on("SIGINT", () => {
|
|
108
|
+
endPrompt(true);
|
|
109
|
+
});
|
|
110
|
+
try {
|
|
111
|
+
while (true) {
|
|
112
|
+
if (lastUILineCount > 0) {
|
|
113
|
+
for (let i = 0; i < lastUILineCount; i++) {
|
|
114
|
+
process.stdout.write("\x1B[1A\x1B[2K");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
lastUILineCount = renderPrompt({
|
|
118
|
+
title: adjustedTitle,
|
|
119
|
+
...content ? { content } : {},
|
|
120
|
+
borderColor,
|
|
121
|
+
titleColor,
|
|
122
|
+
titleTypography,
|
|
123
|
+
...titleVariant ? { titleVariant } : {},
|
|
124
|
+
contentColor,
|
|
125
|
+
contentTypography,
|
|
126
|
+
...contentVariant ? { contentVariant } : {},
|
|
127
|
+
hintPlaceholderColor,
|
|
128
|
+
border,
|
|
129
|
+
variantOptions,
|
|
130
|
+
errorMessage,
|
|
131
|
+
effectiveDefault,
|
|
132
|
+
displayInstructions,
|
|
133
|
+
defaultHint,
|
|
134
|
+
instructions,
|
|
135
|
+
isRerender: errorMessage !== ""
|
|
136
|
+
// Only rerender if there's an error
|
|
137
|
+
});
|
|
138
|
+
const formattedBar = bar({ borderColor });
|
|
139
|
+
const answer = (await rl.question(`${formattedBar} `)).toLowerCase().trim();
|
|
140
|
+
let result;
|
|
141
|
+
if (!answer) {
|
|
142
|
+
deleteLastLine();
|
|
143
|
+
msg({
|
|
144
|
+
type: "M_NULL",
|
|
145
|
+
title: `${colorize(re.reset(formattedBar), borderColor)} ${re.reset(effectiveDefault ? "y" : "n")}`
|
|
146
|
+
});
|
|
147
|
+
result = effectiveDefault;
|
|
148
|
+
} else if (answer === "y" || answer === "yes") {
|
|
149
|
+
result = true;
|
|
150
|
+
} else if (answer === "n" || answer === "no") {
|
|
151
|
+
result = false;
|
|
152
|
+
} else {
|
|
153
|
+
errorMessage = 'Please answer with "y" or "n".';
|
|
154
|
+
deleteLastLine();
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
return await completePrompt(
|
|
158
|
+
"confirm",
|
|
159
|
+
false,
|
|
160
|
+
endTitle,
|
|
161
|
+
endTitleColor,
|
|
162
|
+
titleTypography,
|
|
163
|
+
titleVariant ? titleVariant : void 0,
|
|
164
|
+
border,
|
|
165
|
+
borderColor,
|
|
166
|
+
action,
|
|
167
|
+
result
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
} finally {
|
|
171
|
+
rl.close();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { InputPromptOptions } from "../../core-types.js";
|
|
2
|
+
/**
|
|
3
|
+
* inputPrompt()
|
|
4
|
+
*
|
|
5
|
+
* Main entry point to prompt the user for input.
|
|
6
|
+
* - Renders a text prompt with optional hint, placeholder, and content.
|
|
7
|
+
* - Waits for user input (supporting "plain" or "password" modes).
|
|
8
|
+
* - Validates input with an optional TypeBox schema or custom validate() fn.
|
|
9
|
+
* - Shows errors if invalid, re-prompts if necessary.
|
|
10
|
+
* - Handles Ctrl+C gracefully, optionally printing an endTitle.
|
|
11
|
+
* - Returns the user's validated input, or a default value if empty.
|
|
12
|
+
*
|
|
13
|
+
* @param options InputPromptOptions to customize the prompt.
|
|
14
|
+
* @returns A Promise resolving to the validated user input (string).
|
|
15
|
+
*/
|
|
16
|
+
export declare function inputPrompt(options: InputPromptOptions): Promise<string>;
|