@flowscripter/dynamic-cli-framework-api
    Preparing search index...

    Interface PrinterService

    Service allowing a Command to output user messages to stdout and/or stderr.

    Output to stdout is via print whilst output to stderr is via a filtered logging mechanism using debug, info, warn and error.

    interface PrinterService {
        colorEnabled: boolean;
        darkMode: boolean;
        hyperlinksEnabled: boolean;
        stderrWritable: WritableStream;
        stdoutWritable: WritableStream;
        backgroundBlue(message: string): string;
        backgroundColor(message: string, hexFormattedColor: string): string;
        backgroundCyan(message: string): string;
        backgroundEmphasised(message: string): string;
        backgroundGreen(message: string): string;
        backgroundMagenta(message: string): string;
        backgroundOrange(message: string): string;
        backgroundPrimary(message: string): string;
        backgroundRed(message: string): string;
        backgroundSecondary(message: string): string;
        backgroundSelected(message: string): string;
        backgroundViolet(message: string): string;
        backgroundYellow(message: string): string;
        blue(message: string): string;
        clearMarked(minimumDisplayTimeMs?: number): Promise<void>;
        color(message: string, hexFormattedColor: string): string;
        cyan(message: string): string;
        debug(message: string, icon?: Icon): Promise<void>;
        discardMark(): void;
        emphasised(message: string): string;
        endMark(): void;
        endQuote(): void;
        error(message: string, icon?: Icon): Promise<void>;
        getLevel(): Level;
        green(message: string): string;
        hideAllProgressBars(): Promise<void>;
        hideProgressBar(handle: number): Promise<void>;
        hideSpinner(): Promise<void>;
        hyperlink(text: string, url: string): string;
        info(message: string, icon?: Icon): Promise<void>;
        italic(message: string): string;
        magenta(message: string): string;
        orange(message: string): string;
        primary(message: string): string;
        print(message: string, icon?: Icon): Promise<void>;
        red(message: string): string;
        secondary(message: string): string;
        selected(message: string): string;
        setLevel(level: Level): void;
        showProgressBar(options?: ProgressBarOptions): Promise<number>;
        showSpinner(message: string, style?: SpinnerStyle): Promise<void>;
        startMark(): void;
        startQuote(hexFormattedColor?: string): void;
        stderrColumns(): number;
        stdoutColumns(): number;
        updateProgressBar(handle: number, current: number, message?: string): void;
        violet(message: string): string;
        warn(message: string, icon?: Icon): Promise<void>;
        yellow(message: string): string;
    }
    Index
    colorEnabled: boolean

    Disable or enable color output for messages.

    darkMode: boolean

    Enable or disable dark mode. Default is disabled i.e. false.

    hyperlinksEnabled: boolean

    Disable or enable hyperlink output for messages.

    stderrWritable: WritableStream

    The WritableStream used for stderr. Can be accessed directly for output of binary data etc.

    stdoutWritable: WritableStream

    The WritableStream used for stdout. Can be accessed directly for output of binary data etc.

    • Return the provided message so that the background is the specified color. Has no effect if colorEnabled is false.

      Parameters

      • message: string

        the message to color.

      • hexFormattedColor: string

        the color to use. This should be a valid hex formatted string e.g. "#rrggbb".

      Returns string

    • Return the provided message so that the background is colored as emphasised content. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      Returns string

    • Return the provided message so that the background is colored as primary content. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      Returns string

    • Return the provided message so that the background is colored as secondary content. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      Returns string

    • Return the provided message so that the background is colored as selected content. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      Returns string

    • Erase the terminal rows tracked since the last startMark/endMark pair, moving any following content up.

      Parameters

      • OptionalminimumDisplayTimeMs: number

        optional minimum time (in milliseconds) that must have elapsed since endMark was called before the rows are erased; if less time has elapsed, waits for the remainder before clearing. Defaults to 0.

        Throws if called without a preceding endMark.

      Returns Promise<void>

    • Return the provided message so that the foreground is the specified color. Has no effect if colorEnabled is false.

      Parameters

      • message: string

        the message to color.

      • hexFormattedColor: string

        the color to use. This should be a valid hex formatted string e.g. "#rrggbb".

      Returns string

    • Stop tracking rows for the current mark region (see startMark) without erasing them, resetting the mark bookkeeping so a subsequent startMark does not throw. Use this instead of clearMarked when the marked output should be left on screen - e.g. when a spawned command failed and its output should remain visible.

      Throws if called without a preceding startMark.

      Returns void

    • Return the provided message so that the foreground is colored as emphasised content. The actual color will depend on the value of darkMode. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      Returns string

    • Hides all progress bars.

      NOTE: Showing the spinner will also hide ALL progress bars.

      Returns Promise<void>

    • Hides a specified progress bar.

      NOTE: Showing the spinner will also hide ALL progress bars.

      Parameters

      • handle: number

        the handle referring to the progress bar to be hidden.

      Returns Promise<void>

    • Return the provided text wrapped in an OSC 8 hyperlink to the specified URL. Has no effect if hyperlinksEnabled is false, in which case the text is returned unchanged.

      Parameters

      • text: string

        the text to display as the hyperlink.

      • url: string

        the URL target of the hyperlink.

      Returns string

    • Print an Level.INFO level message on stderr. Will be displayed as primary content if colorEnabled is true.

      Parameters

      • message: string

        the message to output.

      • Optionalicon: Icon

        optional icon to display with the message.

      Returns Promise<void>

    • Return the provided message so that the text is displayed in italic.

      Parameters

      • message: string

      Returns string

    • Return the provided message so that the foreground is colored as primary content. This is the default calor applied. The actual color will depend on the value of darkMode. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      Returns string

    • Print a message on stdout. Will be displayed as primary content if colorEnabled is true.

      Parameters

      • message: string

        the message to output.

      • Optionalicon: Icon

        optional icon to display with the message.

      Returns Promise<void>

    • Return the provided message so that the foreground is colored as secondary content. The actual color will depend on the value of darkMode. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      Returns string

    • Return the provided message so that the background is colored as selected content. The actual color will depend on the value of darkMode. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      Returns string

    • Display the spinner on stderr.

      The spinner will be displayed as emphasised content and the message will be displayed as primary content if colorEnabled is true.

      NOTE: The spinner and message will be displayed at Level.INFO level.

      NOTE: If the spinner is already displayed the message will be updated to that specified.

      NOTE: If any progress bars are currently displayed they will be hidden.

      Parameters

      • message: string

        the message to output after the spinner.

      • Optionalstyle: SpinnerStyle

        optional spinner animation style, defaults to SpinnerStyle.BOX.

      Returns Promise<void>

    • Start tracking the terminal rows occupied by subsequent writes so they can later be erased via clearMarked. Only one mark region can be active at a time.

      Throws if called while already marking.

      Returns void

    • Start a quoted, indented block of output. While active, every line written via print, debug, info, warn or error is prefixed with box-drawing indent characters. Quotes can be nested by calling startQuote again before calling endQuote; each nesting level renders in its own color and adds another indent column.

      Parameters

      • OptionalhexFormattedColor: string

        optional color for this level's indent characters, e.g. "#rrggbb". Defaults to the secondary theme color if not specified.

      Returns void

    • The number of columns available on the stderr terminal. Defaults to 80 if the terminal width cannot be determined.

      Returns number

    • The number of columns available on the stdout terminal. Defaults to 80 if the terminal width cannot be determined.

      Returns number

    • Update a specific progress bar.

      Parameters

      • handle: number

        the handle referring to the progress bar to be updated.

      • current: number

        the current value to set on the progress bar.

      • Optionalmessage: string

        an optional message to set on the progress bar, if not specified the initially specified message will be displayed.

      Returns void