A convenient CLI tool to quickly spin up DragonflyBSD virtual machines using QEMU with sensible defaults.

Refactor runQemu to use Effect for improved control flow

+10 -6
+10 -6
src/utils.ts
··· 336 336 }); 337 337 338 338 export const runQemu = (isoPath: string | null, options: Options) => { 339 - const macAddress = generateRandomMacAddress(); 340 - const name = Moniker.choose(); 341 - const qemuArgs = buildQemuArgs(isoPath, options, macAddress); 339 + return pipe( 340 + generateRandomMacAddress(), 341 + Effect.flatMap((macAddress) => { 342 + const name = Moniker.choose(); 343 + const qemuArgs = buildQemuArgs(isoPath, options, macAddress); 342 344 343 - return options.detach 344 - ? runDetachedQemu(name, isoPath, options, macAddress, qemuArgs) 345 - : runAttachedQemu(name, isoPath, options, macAddress, qemuArgs); 345 + return options.detach 346 + ? runDetachedQemu(name, isoPath, options, macAddress, qemuArgs) 347 + : runAttachedQemu(name, isoPath, options, macAddress, qemuArgs); 348 + }), 349 + ); 346 350 }; 347 351 348 352 export function handleInput(input?: string): string {