aigroup-workflow 1.1.2 → 1.1.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/cli/utils/prompts.mjs +15 -9
- package/package.json +1 -1
package/cli/utils/prompts.mjs
CHANGED
|
@@ -90,17 +90,20 @@ export async function multiSelect(message, choices) {
|
|
|
90
90
|
|
|
91
91
|
function render(isFirst) {
|
|
92
92
|
if (!isFirst) {
|
|
93
|
-
//
|
|
94
|
-
process.stdout.write(
|
|
93
|
+
// 光标在提示行末尾(无换行),清除当前行,再逐行回退并清除
|
|
94
|
+
process.stdout.write('\r\x1b[2K')
|
|
95
|
+
for (let n = 0; n < choices.length; n++) {
|
|
96
|
+
process.stdout.write('\x1b[1A\x1b[2K')
|
|
97
|
+
}
|
|
95
98
|
}
|
|
96
99
|
for (const [i, c] of choices.entries()) {
|
|
97
|
-
|
|
100
|
+
process.stdout.write(renderLine(c, i) + '\n')
|
|
98
101
|
}
|
|
99
102
|
process.stdout.write(renderHint())
|
|
100
103
|
}
|
|
101
104
|
|
|
102
|
-
//
|
|
103
|
-
|
|
105
|
+
// 标题行
|
|
106
|
+
process.stdout.write(`\n ${C.cyan}?${C.reset} ${C.bold}${message}${C.reset} ${C.dim}(空格选择, 回车确认)${C.reset}\n`)
|
|
104
107
|
process.stdout.write(C.hideCursor)
|
|
105
108
|
render(true)
|
|
106
109
|
|
|
@@ -187,16 +190,19 @@ export async function select(message, choices) {
|
|
|
187
190
|
|
|
188
191
|
function render(isFirst) {
|
|
189
192
|
if (!isFirst) {
|
|
190
|
-
process.stdout.write(
|
|
193
|
+
process.stdout.write('\r\x1b[2K')
|
|
194
|
+
for (let n = 0; n < choices.length; n++) {
|
|
195
|
+
process.stdout.write('\x1b[1A\x1b[2K')
|
|
196
|
+
}
|
|
191
197
|
}
|
|
192
198
|
for (const [i, c] of choices.entries()) {
|
|
193
|
-
|
|
199
|
+
process.stdout.write(renderLine(c, i) + '\n')
|
|
194
200
|
}
|
|
195
201
|
process.stdout.write(renderHint())
|
|
196
202
|
}
|
|
197
203
|
|
|
198
|
-
//
|
|
199
|
-
|
|
204
|
+
// 标题行
|
|
205
|
+
process.stdout.write(`\n ${C.cyan}?${C.reset} ${C.bold}${message}${C.reset}\n`)
|
|
200
206
|
process.stdout.write(C.hideCursor)
|
|
201
207
|
render(true)
|
|
202
208
|
|