Represents the context in which a command is executed

interface ICliExecutionContext {
    clipboard: ICliClipboard;
    executor: ICliCommandExecutorService;
    logger: ICliLogger;
    onAbort: Subject<void>;
    options?: CliOptions;
    process: ICliExecutionProcess;
    progressBar: ICliPercentageProgressBar;
    services: ICliServiceProvider;
    setContextProcessor: (
        processor: ICliCommandProcessor,
        silent?: boolean,
    ) => void;
    showPrompt: () => void;
    spinner?: ICliSpinner;
    state: ICliStateStore;
    terminal: Terminal;
    textAnimator?: ICliTextAnimator;
    userSession?: ICliUserSession;
    writer: ICliTerminalWriter;
}

Properties

clipboard: ICliClipboard

The clipboard to use for copying/pasting

The command executor to use for executing commands

logger: ICliLogger

The logger to use for logging

onAbort: Subject<void>

A subject that emits when the command is aborted

options?: CliOptions

The options for the CLI

The process to use for exiting the CLI

The progress bar to use for showing progress

The services to use for the CLI context

setContextProcessor: (processor: ICliCommandProcessor, silent?: boolean) => void

Set the current processor as the context processor, i.e. the processor that will handle the command

Type declaration

    • (processor: ICliCommandProcessor, silent?: boolean): void
    • Parameters

      • processor: ICliCommandProcessor

        The processor to set

      • Optionalsilent: boolean

        Indicates if the setting should be silent, i.e. not write to the terminal

      Returns void

showPrompt: () => void

The prompt to use for prompting the user for input

spinner?: ICliSpinner

The spinner to use for showing/hiding the loader

The state store to use for storing state

terminal: Terminal

The terminal to use for writing

textAnimator?: ICliTextAnimator

The text animator to use for showing/hiding text

userSession?: ICliUserSession

The current user session

The writer to use for writing to the terminal