tcmts.cli.help

Types

ParamShape type
RouteShape type
What tcm reads of a route definition: its description, parameters and child routes.

Server

described (p: ParamShape) => string
helpText (path: string[]) => string
Help for a command (`path` from its name down, e.g. ["data", "migrate"]), or for tcm itself.
rootHelp () => string
rows (items: [string, string][]) => string[]
usageError (path: string[], result: { code: string; issues?: { message: string; path?: unknown[] | undefined; …
A parse failure, as tcm reports it: what's wrong (with the option meant, for one that's misspelt), and what the command takes, as its help says: its usage, arguments and options. `--branch` given to a command that changes things is refused, saying which commands read another branch.
usageOf (path: string[]) => string[]
What a command takes, as its help says it: its usage line (its subcommands'), arguments, subcommands and options. Help shows it, and so does a usage error.

Shared

argLabel (p: ParamShape) => string
`<name>`, `[file]`, `[names...]`: an argument as usage shows it.
childrenOf (r: RouteShape) => RouteShape[]
distance (a: string, b: string) => number
The edit distance between two words, for suggesting the command someone meant.
fallback (p: ParamShape) => { value: unknown; } | undefined
What a parameter is when it's left out: undefined if it's required.
isToggle (p: ParamShape) => boolean
lookup (path: string[]) => RouteShape
A command's route, or one of its subcommands' (`["data", "migrate"]`), with its help: as help shows it.
nearNames (paths: string[], target: string, most?: number) => string[]
The names closest to one that isn't there, most likely first: the same last part under another namespace (sharing more of the namespace first), then the names fewest letters off, if they're only a few.
notFound (paths: string[], target: string) => string
What to say for a name that isn't found, given the names there are: a namespace's (what it holds), or the names meant most likely (the same name in another namespace, or one spelled almost the same).
optionLabel (p: ParamShape) => string
paramsOf (r: RouteShape) => ParamShape[]
readsBranches (path: string[]) => boolean
Whether a command only reads, and so reads another branch with `--branch` (`readBranch`): `tcm branch <name>`'s argument, and `tcm mcp --branch`, are other things. (Every run asks, so it reads the route alone, not the help.)
routeOf (path: string[]) => RouteShape
What parsing reads of a command, or of one of its subcommands (`["data", "migrate"]`): its route, without its help. Help reads lookup.
shape (definition: unknown) => RouteShape
suggest (word: string) => string[]
The commands closest to a mistyped one (or starting with it).
withHelp (r: RouteShape, h: Help | undefined) => RouteShape
A route as help shows it: with the descriptions its help gives it, its parameters and its subcommands (those many commands share from commonHelp).

Tests

testHelpCoversEveryCommand () => void
testNotFoundSaysWhatWasMeant () => void