Interface Terminal
interface Terminal {
addons: Map<string, ITerminalAddon>;
ansi: {
style: {
bold: string;
cyan: string;
gray: string;
green: string;
red: string;
reset: string;
yellow: string;
[key: string]: string;
};
};
cmd: string;
commands: Record<string, TerminalCommand>;
cwd: string;
emojis: any;
events: any;
id: string;
promptTemplate: string;
socket?: WebSocket;
socketKey?: JsonWebKey;
stderr: WritableStream<Uint8Array>;
stdin: ReadableStream<Uint8Array>;
stdout: WritableStream<Uint8Array>;
clearCommand(): string;
connect(socket: WebSocket): void;
createSpecialLink(uri: string, text: string): string;
getInputStream(): ReadableStream<Uint8Array>;
hide(): void;
listen(): void;
mount(element: HTMLElement): void;
paste(data?: string): Promise<void>;
prompt(text?: string): string;
readline(
prompt?: string,
hide?: boolean,
noListen?: boolean,
): Promise<string>;
restoreCommand(cmd: string): void;
spinner(spinner: string, prefix?: string, suffix?: string): any;
unlisten(): void;
write(data: string | Uint8Array): void;
writeln(data: string | Uint8Array): void;
}
addons: Map<string, ITerminalAddon>;
ansi: {
style: {
bold: string;
cyan: string;
gray: string;
green: string;
red: string;
reset: string;
yellow: string;
[key: string]: string;
};
};
cmd: string;
commands: Record<string, TerminalCommand>;
cwd: string;
emojis: any;
events: any;
id: string;
promptTemplate: string;
socket?: WebSocket;
socketKey?: JsonWebKey;
stderr: WritableStream<Uint8Array>;
stdin: ReadableStream<Uint8Array>;
stdout: WritableStream<Uint8Array>;
clearCommand(): string;
connect(socket: WebSocket): void;
createSpecialLink(uri: string, text: string): string;
getInputStream(): ReadableStream<Uint8Array>;
hide(): void;
listen(): void;
mount(element: HTMLElement): void;
paste(data?: string): Promise<void>;
prompt(text?: string): string;
readline(
prompt?: string,
hide?: boolean,
noListen?: boolean,
): Promise<string>;
restoreCommand(cmd: string): void;
spinner(spinner: string, prefix?: string, suffix?: string): any;
unlisten(): void;
write(data: string | Uint8Array): void;
writeln(data: string | Uint8Array): void;
}
Hierarchy
- Terminal
- Terminal
Properties
Readonly
addons
Get terminal addons
Readonly
ansi
ansi: {
style: {
bold: string;
cyan: string;
gray: string;
green: string;
red: string;
reset: string;
yellow: string;
[key: string]: string;
};
}
style: {
bold: string;
cyan: string;
gray: string;
green: string;
red: string;
reset: string;
yellow: string;
[key: string]: string;
};
}
Get ANSI escape sequences
Readonly
cmd
cmd: string
Get current command
Readonly
commands
Get terminal commands
Readonly
cwd
cwd: string
Get current working directory
Readonly
emojis
emojis: any
Get emoji utilities
Readonly
events
events: any
Get event emitter
Readonly
id
id: string
Get terminal ID
promptTemplate
promptTemplate: string
Get/set prompt template
Optional
Readonly
socket
Get WebSocket connection
Optional
Readonly
socketKey
Get socket public key
Readonly
stderr
Get standard error stream
Readonly
stdin
Get standard input stream
Readonly
stdout
Get standard output stream
Methods
clearCommand
connect
createSpecialLink
getInputStream
- getInputStream(): ReadableStream<Uint8Array>
Get input stream
Returns ReadableStream<Uint8Array>
hide
listen
mount
- mount(element: HTMLElement): void
Mount terminal to DOM element
Parameters
- element: HTMLElement
Element to mount to
Returns void
- element: HTMLElement
paste
prompt
readline
restoreCommand
spinner
unlisten
write
- write(data: string | Uint8Array): void
Write text to terminal
Parameters
- data: string | Uint8Array
Text to write
Returns void
- data: string | Uint8Array
writeln
- writeln(data: string | Uint8Array): void
Write line to terminal
Parameters
- data: string | Uint8Array
Text to write
Returns void
- data: string | Uint8Array
Interface for terminal functionality