Interface Terminal

Interface for terminal functionality

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;
}
Hierarchy
  • Terminal
    • Terminal

Properties

addons: Map<string, ITerminalAddon>

Get terminal addons

ansi: {
    style: {
        bold: string;
        cyan: string;
        gray: string;
        green: string;
        red: string;
        reset: string;
        yellow: string;
        [key: string]: string;
    };
}

Get ANSI escape sequences

cmd: string

Get current command

commands: Record<string, TerminalCommand>

Get terminal commands

cwd: string

Get current working directory

emojis: any

Get emoji utilities

events: any

Get event emitter

id: string

Get terminal ID

promptTemplate: string

Get/set prompt template

socket?: WebSocket

Get WebSocket connection

socketKey?: JsonWebKey

Get socket public key

Get standard error stream

Get standard input stream

Get standard output stream

Methods

  • Create a special terminal link

    Parameters

    • uri: string

      Link URI

    • text: string

      Link text

    Returns string

  • Get terminal prompt

    Parameters

    • Optionaltext: string

      Prompt text

    Returns string

  • Read a line of input

    Parameters

    • Optionalprompt: string

      Input prompt

    • Optionalhide: boolean

      Hide input

    • OptionalnoListen: boolean

      Don't auto-listen

    Returns Promise<string>

  • Restore terminal command

    Parameters

    • cmd: string

      Command to restore

    Returns void

  • Create a spinner

    Parameters

    • spinner: string

      Spinner type

    • Optionalprefix: string

      Prefix text

    • Optionalsuffix: string

      Suffix text

    Returns any