feat(config): add interactive config editor and GitLab PR support #4
@@ -611,14 +611,11 @@ async function showMenu(): Promise<void> {
|
|||||||
|
|
||||||
if (selected === null || selected === BACK) return;
|
if (selected === null || selected === BACK) return;
|
||||||
|
|
||||||
const result =
|
if (selected === "commit") await handleCommit(false, false);
|
||||||
selected === "commit"
|
else if (selected === "pr") await handlePR(false);
|
||||||
? await handleCommit(false, false)
|
else await handleConfig();
|
||||||
: selected === "pr"
|
|
||||||
? await handlePR(false)
|
|
||||||
: await handleConfig();
|
|
||||||
|
|
||||||
if (result !== "back") return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -663,8 +660,9 @@ async function handleCommit(
|
|||||||
const unstagedFiles = await getUnstagedFiles();
|
const unstagedFiles = await getUnstagedFiles();
|
||||||
|
|
||||||
if (stagedFiles.length === 0 && unstagedFiles.length === 0) {
|
if (stagedFiles.length === 0 && unstagedFiles.length === 0) {
|
||||||
console.log(" Nothing to commit.");
|
console.log(`\n ${YELLOW}Nothing to commit.${RESET}`);
|
||||||
return "done";
|
await ask(` ${DIM}Press Enter to exit...${RESET}`);
|
||||||
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unstagedFiles.length > 0) {
|
if (unstagedFiles.length > 0) {
|
||||||
@@ -687,8 +685,9 @@ async function handleCommit(
|
|||||||
|
|
||||||
const diff = await getStagedDiff();
|
const diff = await getStagedDiff();
|
||||||
if (!diff) {
|
if (!diff) {
|
||||||
console.log(" No staged changes to commit.");
|
console.log(`\n ${YELLOW}No staged changes to commit.${RESET}`);
|
||||||
return "done";
|
await ask(` ${DIM}Press Enter to exit...${RESET}`);
|
||||||
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MAX_DIFF_SIZE = 15000;
|
const MAX_DIFF_SIZE = 15000;
|
||||||
@@ -817,9 +816,10 @@ async function handlePR(draft: boolean): Promise<"done" | "back"> {
|
|||||||
|
|
||||||
if (commits.length === 0) {
|
if (commits.length === 0) {
|
||||||
console.error(
|
console.error(
|
||||||
` ${RED}Error: No commits on ${branchName} compared to ${baseBranch}. Commit something first.${RESET}`,
|
`\n ${YELLOW}No commits on ${branchName} compared to ${baseBranch}. Commit something first.${RESET}`,
|
||||||
);
|
);
|
||||||
process.exit(1);
|
await ask(` ${DIM}Press Enter to exit...${RESET}`);
|
||||||
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
|
|||||||
Reference in New Issue
Block a user