aigroup-workflow 1.1.3 → 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 +9 -8
- package/package.json +1 -1
package/cli/utils/prompts.mjs
CHANGED
|
@@ -88,13 +88,13 @@ export async function multiSelect(message, choices) {
|
|
|
88
88
|
return ` ${C.dim}↑↓ 移动${C.reset} ${C.dim}空格 选择${C.reset} ${C.dim}a 全选/取消${C.reset} ${C.dim}回车 确认${C.reset}`
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
// 总行数 = 选项行 + 提示行
|
|
92
|
-
const totalLines = choices.length + 1
|
|
93
|
-
|
|
94
91
|
function render(isFirst) {
|
|
95
92
|
if (!isFirst) {
|
|
96
|
-
//
|
|
97
|
-
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
|
+
}
|
|
98
98
|
}
|
|
99
99
|
for (const [i, c] of choices.entries()) {
|
|
100
100
|
process.stdout.write(renderLine(c, i) + '\n')
|
|
@@ -188,11 +188,12 @@ export async function select(message, choices) {
|
|
|
188
188
|
return ` ${C.dim}↑↓ 移动${C.reset} ${C.dim}回车 选择${C.reset}`
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
const totalLines = choices.length + 1
|
|
192
|
-
|
|
193
191
|
function render(isFirst) {
|
|
194
192
|
if (!isFirst) {
|
|
195
|
-
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
|
+
}
|
|
196
197
|
}
|
|
197
198
|
for (const [i, c] of choices.entries()) {
|
|
198
199
|
process.stdout.write(renderLine(c, i) + '\n')
|