Skip to content

Commit 88d3481

Browse files
committed
refactor: remove dead formatPatchloomOutput and formatBatchOutput wrappers
Both were trivial pass-throughs to formatCliOutput left over from the cycle 5 deduplication extraction. Callers now use formatCliOutput directly. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
1 parent a3873f2 commit 88d3481

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

src/commands/batchApply.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export async function batchApply(): Promise<void> {
8686
if (result.exitCode !== 0) {
8787
log?.show();
8888
await vscode.window.showErrorMessage(
89-
`Batch apply failed: ${formatBatchOutput(result)}`
89+
`Batch apply failed: ${formatCliOutput(result)}`
9090
);
9191
return;
9292
}
@@ -135,6 +135,3 @@ function executePatchloomWithStdin(
135135
});
136136
}
137137

138-
function formatBatchOutput(result: BatchCommandResult): string {
139-
return formatCliOutput(result);
140-
}

src/commands/quickActions.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export async function runQuickAction(): Promise<void> {
208208
if (result.exitCode === 3) {
209209
await vscode.window.showInformationMessage(`No matches found for "${pattern}".`);
210210
} else if (result.exitCode !== 0) {
211-
await vscode.window.showErrorMessage(`Patchloom search failed: ${formatPatchloomOutput(result)}`);
211+
await vscode.window.showErrorMessage(`Patchloom search failed: ${formatCliOutput(result)}`);
212212
} else {
213213
log?.show();
214214
await vscode.window.showInformationMessage("Search results displayed in the Patchloom output channel.");
@@ -249,7 +249,7 @@ export async function runQuickAction(): Promise<void> {
249249
const result = await executePatchloom(binaryPath, action.args, folder.uri.fsPath);
250250

251251
if (result.exitCode !== 0) {
252-
await vscode.window.showErrorMessage(`Patchloom create failed: ${formatPatchloomOutput(result)}`);
252+
await vscode.window.showErrorMessage(`Patchloom create failed: ${formatCliOutput(result)}`);
253253
return;
254254
}
255255

@@ -289,7 +289,7 @@ export async function runQuickAction(): Promise<void> {
289289
const result = await executePatchloom(binaryPath, action.args, target.workspaceFolder.uri.fsPath);
290290

291291
if (result.exitCode !== 0) {
292-
await vscode.window.showErrorMessage(`Patchloom doc get failed: ${formatPatchloomOutput(result)}`);
292+
await vscode.window.showErrorMessage(`Patchloom doc get failed: ${formatCliOutput(result)}`);
293293
return;
294294
}
295295

@@ -430,7 +430,7 @@ async function previewAndMaybeApply(
430430
const result = await executePatchloom(binaryPath, withApplyFlag(action.args), target.workspaceFolder.uri.fsPath);
431431
if (result.exitCode !== 0) {
432432
await vscode.window.showErrorMessage(
433-
`Patchloom failed while applying changes to ${target.relativePath}: ${formatPatchloomOutput(result)}`
433+
`Patchloom failed while applying changes to ${target.relativePath}: ${formatCliOutput(result)}`
434434
);
435435
return;
436436
}
@@ -457,7 +457,7 @@ async function buildPreviewDocument(
457457
const previewAction = retargetQuickAction(action, tempPath);
458458
const result = await executePatchloom(binaryPath, withApplyFlag(previewAction.args), tempDir);
459459
if (result.exitCode !== 0 && result.exitCode !== 3) {
460-
throw new Error(formatPatchloomOutput(result));
460+
throw new Error(formatCliOutput(result));
461461
}
462462

463463
const previewContent = await fs.readFile(tempPath, "utf8");
@@ -640,10 +640,6 @@ async function executePatchloom(
640640
}
641641
}
642642

643-
function formatPatchloomOutput(result: PatchloomCommandResult): string {
644-
return formatCliOutput(result);
645-
}
646-
647643
function sameFilePath(left: string, right: string): boolean {
648644
const normalize = (value: string) => process.platform === "win32"
649645
? path.resolve(value).toLowerCase()

0 commit comments

Comments
 (0)