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

    Class DefaultPrinterService

    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.

    Implements

    Index
    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

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

      Parameters

      • minimumDisplayTimeMs: number = 0

        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

    • 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'.

      • message: string = ""

        an optional message for the progress bar.

      • total: number = 100

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

      • current: number = 0

        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

      • Optionalmessage: string

        the message to output after the spinner.

      • Optionalstyle: SpinnerStyle

        optional spinner animation style, defaults to SpinnerStyle.BOX.

      Returns Promise<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

    • 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