helpPatch

tcmts.cli.commands.helpPatch · #32il35go · term · runs anywhere

import type { Help } from "#codebase/tcmts/cli/commands";

export const helpPatch: Help = {
  description:
    "change a definition by find-and-replace on its code (as `tcm view` shows it), and save it as update does",
  params: {
    name: "the definition to change",
    old: "text to find in it, once (as written: a \\n is a backslash and an n)",
    new: "what replaces it (as written, as --old is)",
    edits: 'several edits, as JSON: [{"old": "…", "new": "…"}, …]',
    all: "replace every place the text is, not just the one",
    imports:
      'imports to add, for names the code uses that importing can\'t find (an alias), as JSON: [{"name": "…", "from": "…", "as": "…"}, …] (name `default` or `*` with `as`; "type": true for a type only)',
    patches:
      'several definitions at once (pages too), saved together as one update, as JSON: [{"name": "…", "edits": [{"old": "…", "new": "…"}], "all": false, "imports": […]}, …] (no <name> then)',
  },
}

uses

used by