A convenient CLI tool to quickly spin up DragonflyBSD virtual machines using QEMU with sensible defaults.
1import { Effect, pipe } from "effect";
2import { deleteImage, getImage } from "../images.ts";
3import { failOnMissingImage } from "../utils.ts";
4
5export default async function (id: string) {
6 await Effect.runPromise(
7 pipe(
8 getImage(id),
9 Effect.flatMap(failOnMissingImage),
10 Effect.tap(() => deleteImage(id)),
11 Effect.tap(() => console.log(`Image ${id} removed successfully.`)),
12 Effect.catchAll((error) =>
13 Effect.sync(() => {
14 console.error(`Failed to remove image: ${error.message}`);
15 Deno.exit(1);
16 })
17 ),
18 ),
19 );
20}