runRm

tcmts.cli.run.runRm · #uri272ii · term · runs on the server

uses tcmts.cli.main.execute, which uses tcmts.cli.help.usageError, which uses tcmts.cli.help.usageOf, which uses tcmts.cli.style.bold, which uses node:util

Runs tcm rm.

import { routeRm } from "#codebase/tcmts/cli/commands";
import { execute, rm } from "#codebase/tcmts/cli/main";
import type { Context } from "#codebase/tcmts/cli/run";
import { chooseName } from "#codebase/tcmts/cli/ui";
import { parse } from "@bomb.sh/router";

export async function runRm({ cb, cmd, rest }: Context): Promise<number> {
  const { model } = execute(cmd, parse(routeRm(), { argv: rest }));
  const names = model.names.length
    ? model.names
    : [await chooseName(cb, "rm <name>... [--force]", "Remove which name?")];
  // (each in turn; what uses one doesn't count if it's being removed too)
  for (const n of names) await rm(cb, n, !!model.force, new Set(names));
  return 0;
}

uses

used by