Add overwrite button

This commit is contained in:
2021-12-07 15:17:19 +03:00
parent 5e776f686b
commit cb3ccbb4f6

View File

@@ -42,7 +42,11 @@ export async function activate() {
}); });
if (gitConfig.length === 0) { if (gitConfig.length === 0) {
console.error("Missing user creds in git"); console.error("Missing user creds in git");
vscode.window.showErrorMessage("Missing user creds in git"); const option = await vscode.window.showErrorMessage("Missing user creds in git", "Overwrite");
if (option && option === "Overwrite") {
await repository.setConfig("user.name", name);
await repository.setConfig("user.email", email);
}
return; return;
} }
gitConfig.forEach(c => { gitConfig.forEach(c => {
@@ -61,7 +65,11 @@ export async function activate() {
}); });
if (gitName !== name || gitEmail !== email) { if (gitName !== name || gitEmail !== email) {
console.error("Wrong user settings in git"); console.error("Wrong user settings in git");
vscode.window.showErrorMessage("Wrong user settings in git"); const option = await vscode.window.showErrorMessage("Wrong user settings in git", "Overwrite");
if (option && option === "Overwrite") {
await repository.setConfig("user.name", name);
await repository.setConfig("user.email", email);
}
} }
} }
}); });