@flowscripter/dynamic-cli-framework
    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>;
        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(
            units: string,
            message?: string,
            total?: number,
            current?: number,
            style?: ProgressStyle,
        ): 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;
    }

    Implemented by

    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 blue. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      Returns string

    • 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 cyan. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      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 green. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      Returns string

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

      Parameters

      • message: string

      Returns string

    • Return the provided message so that the background is orange. 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 red. 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

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

      Parameters

      • message: string

      Returns string

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

      Parameters

      • message: string

      Returns string

    • Return the provided message so that the foreground is blue. 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

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

      Parameters

      • message: string

      Returns string

    • Print a Level.DEBUG level message on stderr. Will be displayed as secondary 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 emphasised content. The actual color will depend on the value of darkMode. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      Returns string

    • Stop tracking rows for the current mark region (see startMark). The tracked row count is frozen; further writes are not counted. Use clearMarked to erase the tracked rows.

      Throws if called without a matching startMark.

      Returns void

    • End the most recently started quote level (see startQuote).

      Throws if called without a matching startQuote.

      Returns void

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

      Parameters

      • message: string

        the message to output.

      • Optionalicon: Icon

        optional icon to display with the message.

      Returns Promise<void>

    • Get the output threshold Level for stderr.

      Returns Level

    • Return the provided message so that the foreground is green. 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>

    • Hide the spinner.

      NOTE: Showing a progress bar will also hide the spinner.

      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 magenta. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      Returns string

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

      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 red. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      Returns string

    • 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

    • Set the output threshold Level for stderr.

      Default level is Level.INFO.

      Parameters

      • level: Level

        any message below this level will be filtered from output,

      Returns void

    • Display a progress bar on stderr.

      The progress will be displayed in green if colorEnabled is true.

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

      NOTE: If the spinner is currently displayed it will be hidden.

      Parameters

      • units: string

        the units to display for progress indication e.g. 'MB' or 'Kb'.

      • Optionalmessage: string

        an optional message for the progress bar.

      • Optionaltotal: number

        the total value which equates to 100% complete, defaults to 100.

      • Optionalcurrent: number

        the current value which is a portion of the total value, defaults to 0.

      • Optionalstyle: ProgressStyle

        optional progress bar rendering style, defaults to ProgressStyle.STROKE.

      Returns Promise<number>

      a handle to use when invoking updateProgressBar.

    • 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

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

      Parameters

      • message: string

      Returns string

    • Print a Level.WARN level message on stderr. Will be displayed as yellow 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 yellow. Has no effect if colorEnabled is false.

      Parameters

      • message: string

      Returns string