import { confirm as clackConfirm } from "@clack/prompts"; import {
listSandboxBrowsers,
listSandboxContainers,
removeSandboxBrowserContainer,
removeSandboxContainer,
type SandboxBrowserInfo,
type SandboxContainerInfo,
} from "../agents/sandbox.js"; import { type RuntimeEnv, writeRuntimeJson } from "../runtime.js"; import {
displayBrowsers,
displayContainers,
displayRecreatePreview,
displayRecreateResult,
displaySummary,
} from "./sandbox-display.js";
// --- Types ---
type SandboxListOptions = {
browser: boolean;
json: boolean;
};
async function confirmRecreate(): Promise<boolean> { const result = await clackConfirm({
message: "This will stop and remove these containers. Continue?",
initialValue: false,
});
return result !== false && result !== Symbol.for("clack:cancel");
}
async function removeContainers(
filtered: FilteredContainers,
runtime: RuntimeEnv,
): Promise<{ successCount: number; failCount: number }> {
runtime.log("\nRemoving sandbox runtimes...\n");
let successCount = 0;
let failCount = 0;
for (const container of filtered.containers) { const result = await removeContainer(container.containerName, removeSandboxContainer, runtime); if (result.success) {
successCount++;
} else {
failCount++;
}
}
for (const browser of filtered.browsers) { const result = await removeContainer(
browser.containerName,
removeSandboxBrowserContainer,
runtime,
); if (result.success) {
successCount++;
} else {
failCount++;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.