runShot
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 shot, in a codebase or not.
import { routeShot } from "#codebase/tcmts/cli/commands"; import { execute } from "#codebase/tcmts/cli/main"; import type { Started } from "#codebase/tcmts/cli/run"; import { shot } from "#codebase/tcmts/cli/shot"; import { UsageError } from "#codebase/tcmts/cli/ui"; import { parse } from "@bomb.sh/router"; export async function runShot({ cmd, rest, cwd }: Started): Promise<number> { const m = execute(cmd, parse(routeShot(), { argv: rest })).model; const widths = m.width.length ? m.width.map(Number) : [1280, 390]; for (const [i, w] of widths.entries()) if (!Number.isInteger(w) || w < 100 || w > 4000) throw new UsageError(`--width ${m.width[i]}: a width in pixels, 100 to 4000`); return shot({ cwd, url: m.url, widths, out: m.out, wait: m.wait }); }
uses
- tcmts.cli.commands.routeShot
- tcmts.cli.main.execute
- tcmts.cli.run.Started
- tcmts.cli.shot.shot
- tcmts.cli.ui.UsageError