tcm-ts.txt / code
tcm . cli . ui
Types
UsageError
Server
answer
ask
choose
confirm
interactive
intro
outro
scratchShown
showInstallProgress
shownPath
success
Shared
chooseName
shellWord
Tests
testScratchShown
testShellWord
testShownPath
tcmts.cli.ui
Types
UsageError typeof UsageError
Server
answer <T>(value: symbol | T) => T The answer, or out if they cancelled (Ctrl-C, Esc).
ask (usage: string, message: string, placeholder?: string | undefined) => Promise<string> Free text, asked for if a person can be.
choose <T>(usage: string, message: string, options: { value: T; label: string; hint?: string | undefined; … What `usage` describes, asked for if a person can be: `message`, choosing from `options`.
confirm (message: string) => Promise<boolean> Yes or no; without a terminal, the answer is no.
interactive () => boolean Whether there's someone to ask: a terminal on both ends, and not CI.
intro (title: string) => void | false
outro (message: string) => void
scratchShown (file: string, sessionDir?: string | undefined) => string A scratch file as a command names it, to say how to save it: by its name alone when it's in a session's own directory (`sessionDir`), where a name alone is looked for, or else as `shownPath` says it.
showInstallProgress () => void Package installs (which tcm runs as it needs them) as spinners on a terminal, not lines of text.
shownPath (file: string, from?: string) => string A file's path as tcm says it: from `from` (where it runs) when the file is in there, or else whole. Where the two are is compared as they really are, so a file reached through a link (a session's directory, in a codebase linked from another checkout) isn't shown as a climb out of one and down the other.
success (message: string) => void
Shared
chooseName (cb: Codebase, usage: string, message: string, kind?: "value" | undefined) => Promise<string> One of the branch's names (values only, for `kind: "value"`), asked for by search.
shellWord (s: string) => string `s` as one word of a shell command: quoted if it has to be (a path with a space in it).
Tests
testScratchShown () => void
testShellWord () => void
testShownPath () => void