rootHelp

tcmts.cli.help.rootHelp · #e2hf5w53 · term · runs on the server

uses tcmts.cli.style.bold, which uses node:util

import { helps, helpTcm, routes, SECTIONS } from "#codebase/tcmts/cli/commands";
import { bold, cyan, dim } from "#codebase/tcmts/cli/style";

export function rootHelp(): string {
  const out = [
    `${bold("tcm")} ${dim("—")} ${helpTcm.description}`,
    "",
    bold("Usage"),
    `  tcm ${dim("[options]")}             watch scratch files (tcm watch)`,
    `  tcm <command> ${dim("[args] [options]")}`,
  ];
  const all = Object.keys(routes());
  const width = Math.max(...all.map((c) => c.length));
  const texts = helps();
  for (const [title, names] of SECTIONS) {
    out.push("", bold(title));
    for (const n of names) out.push(`  ${cyan(n.padEnd(width))}  ${texts[n]?.description ?? ""}`);
  }
  out.push(
    "",
    dim(
      "`tcm <command> --help` shows a command's arguments and options. `source <(tcm complete zsh)` completes",
    ),
    dim("commands, options and the codebase's names as you type (also bash, fish and powershell)."),
  );
  return out.join("\n");
}

uses

used by