feat(cli): add config command and improve menu clearing
This commit is contained in:
@@ -277,6 +277,7 @@ interface MenuAction {
|
|||||||
|
|
||||||
const MENU_ACTIONS: MenuAction[] = [
|
const MENU_ACTIONS: MenuAction[] = [
|
||||||
{ key: "commit", label: "commit", description: "Generate AI commit message" },
|
{ key: "commit", label: "commit", description: "Generate AI commit message" },
|
||||||
|
{ key: "config", label: "config", description: "Configure API settings" },
|
||||||
];
|
];
|
||||||
|
|
||||||
async function showMenu(): Promise<void> {
|
async function showMenu(): Promise<void> {
|
||||||
@@ -304,9 +305,9 @@ async function showMenu(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clearMenu() {
|
function clearMenu() {
|
||||||
process.stdout.write(`\x1b[${totalLines}A`);
|
process.stdout.write(`\x1b[${headerLines}A`);
|
||||||
for (let i = 0; i < totalLines; i++) {
|
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`);
|
process.stdout.write(`\x1b[${totalLines}A`);
|
||||||
}
|
}
|
||||||
@@ -384,6 +385,8 @@ async function showMenu(): Promise<void> {
|
|||||||
|
|
||||||
if (selected.key === "commit") {
|
if (selected.key === "commit") {
|
||||||
handleCommit(false, false).then(resolve);
|
handleCommit(false, false).then(resolve);
|
||||||
|
} else if (selected.key === "config") {
|
||||||
|
handleConfig().then(resolve);
|
||||||
} else {
|
} else {
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user