Refactor both if branches to be the same
Parsing no longer depends on ui widget
This commit is contained in:
parent
b6696a4f6c
commit
dcba79cda0
@ -1,4 +1,4 @@
|
|||||||
import {type ExtensionAPI, isBashToolResult} from "@earendil-works/pi-coding-agent";
|
import {type ExtensionAPI, isBashToolResult, ThemeColor} from "@earendil-works/pi-coding-agent";
|
||||||
import {isTestCommand, parseTestOutput} from "./parsing/typescript-command-output";
|
import {isTestCommand, parseTestOutput} from "./parsing/typescript-command-output";
|
||||||
|
|
||||||
// noinspection JSUnusedGlobalSymbols
|
// noinspection JSUnusedGlobalSymbols
|
||||||
@ -15,13 +15,14 @@ export default function testStatusExtension(pi: ExtensionAPI) {
|
|||||||
|
|
||||||
const testResult = parseTestOutput(output);
|
const testResult = parseTestOutput(output);
|
||||||
|
|
||||||
|
const feedbackTheme : ThemeColor = (testResult.status === "Success") ? "success" : "error";
|
||||||
if (testResult.status === "Success") {
|
if (testResult.status === "Success") {
|
||||||
ctx.ui.setWidget("test-status", [
|
ctx.ui.setWidget("test-status", [
|
||||||
`${theme.fg("success", "●")} ${theme.fg("text", testResult.summary)}`,
|
`${theme.fg(feedbackTheme, "●")} ${theme.fg("text", testResult.summary)}`,
|
||||||
]);
|
]);
|
||||||
} else if (testResult.status === "Fail" || event.isError) {
|
} else if (testResult.status === "Fail" || event.isError) {
|
||||||
ctx.ui.setWidget("test-status", [
|
ctx.ui.setWidget("test-status", [
|
||||||
`${theme.fg("error", "●")} ${theme.fg("text", testResult.summary)}`,
|
`${theme.fg(feedbackTheme, "●")} ${theme.fg("text", testResult.summary)}`,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user