feat(cli): add config command and improve menu clearing

This commit is contained in:
2026-06-09 18:14:18 +08:00
parent 0906e304a1
commit 798cdbbadf
+5 -2
View File
@@ -277,6 +277,7 @@ interface MenuAction {
const MENU_ACTIONS: MenuAction[] = [
{ key: "commit", label: "commit", description: "Generate AI commit message" },
{ key: "config", label: "config", description: "Configure API settings" },
];
async function showMenu(): Promise<void> {
@@ -304,9 +305,9 @@ async function showMenu(): Promise<void> {
}
function clearMenu() {
process.stdout.write(`\x1b[${totalLines}A`);
process.stdout.write(`\x1b[${headerLines}A`);
for (let i = 0; i < totalLines; i++) {
process.stdout.write("\x1b[2K\x1b[1B");
process.stdout.write("\r\x1b[2K\n");
}
process.stdout.write(`\x1b[${totalLines}A`);
}
@@ -384,6 +385,8 @@ async function showMenu(): Promise<void> {
if (selected.key === "commit") {
handleCommit(false, false).then(resolve);
} else if (selected.key === "config") {
handleConfig().then(resolve);
} else {
resolve();
}