Registers commands on the server under their own names and every alias.
A failed result, in the words its kind earns.
One command the prompt answers to: the sentence .help prints beside it, and what typing it
does.
-
aliases: readonly string[]
Other names for the same command.
.helpfolds them onto its line as[aliases .c, .n]. -
description: string
What
.helpsays about it. One line: the list is read at a glance or not at all. -
main(): void | Promise<void>repl: ReplContext,argument: string
What typing it does.
replfirst because nearly every command needs it and many ignore the argument entirely — which they can then simply not declare.
Everything a command may need that is not its argument.
-
buffered: string
The unfinished input so far,
''when the line is whole..breakabandons it. -
completionCache: CompletionCache
The cached front of ReplSession.completions — what TAB and the ghost suggestion read.
-
config: ResolvedConfig
The resolved run config this session was opened on.
-
cwd: string
The directory relative paths are resolved against.
-
http: HttpService
The HTTP client's state: headers saved for the next request, and every request made.
-
interactive: boolean
False on a pipe — no terminal to hand to an editor, and nothing to redraw.
-
lines: readonly string[]
Every line this session has evaluated, oldest first — what
.savewrites out. -
log(text: string): void
Says one line to whoever typed the command, ending it for them.
-
palette: Theme
The colours, already resolved for this terminal — unstyled where there is none.
-
scratch: string
The scratch buffer
.openkeeps for the life of the session. -
server: REPLServer
The
node:replserver, for the few commands that need readline itself. -
session: ReplSession
The live page — where values are, and where a
debuggerstops. -
width: number
How wide the terminal is, for anything laid out in columns. 80 where nothing says.
-
write(text: string): void
Writes exactly these bytes — for a block that ends in its own newline, or an escape.
Usage
import * as mod from "lib/commands/repl/command.ts";