import path from "path"; import { OperationOptions, type OptionsType } from "../data"; import { existsSync, rmSync } from "fs"; import z from "zod"; const removeResourceGroupSchema = z.object({ args: z.object({ name: z.string() }) }); export async function removeResourceGroup(options: OperationOptions) { const operationOptions = removeResourceGroupSchema.parse(options.options); const resourceGroupName = operationOptions.args.name; const resourceGroupPath = path.join( process.cwd(), "infrastructure", "resourceGroups", resourceGroupName ); if (!existsSync(resourceGroupPath)) { console.log(`Resource group ${resourceGroupName} does not exist.`); return; } rmSync(resourceGroupPath, { recursive: true, force: true }); console.log(`Resource group ${resourceGroupName} removed.`); }