@types/clui

  • Version 0.3.4
  • Published
  • 6.63 kB
  • 1 dependency
  • MIT license

Install

npm i @types/clui
yarn add @types/clui
pnpm add @types/clui

Overview

TypeScript definitions for clui

Index

Functions

function Gauge

Gauge: (
value: number,
maxValue: number,
guageWidth: number,
dangerZone: number,
suffix: string
) => string;
  • Creates a basic horizontal gauge to the screen

    Parameter value

    The current value of the metric being displayed by this gauge

    Parameter maxValue

    The highest possible value of the metric being displayed

    Parameter guageWidth

    How many columns widt to draw the gauge

    Parameter dangerZone

    The point after which the value will be drawn in red because it's too high

    Parameter suffix

    A value to output after the gauge itself

function Sparkline

Sparkline: (values: number[], suffix: string) => string;
  • A simple command line sparkline that draws a series of values, and highlights the peak for the period

    Parameter values

    An array of values to go into the sparkline

    Parameter suffix

    A suffix to use when drawing the current and max values at the end of the sparkline

Classes

class Line

class Line {}
  • This chainable object can be used to generate a line of text with columns, padding, and fill

constructor

constructor(buffer?: LineBuffer);
  • Create a new instance of Line object

    Parameter buffer

    Object to be used as buffer

method column

column: (text: string, width: number, styles?: clc.Format[]) => Line;
  • Output text within a column of the specified width

    Parameter text

    Text to print

    Parameter width

    Width of the column

    Parameter styles

    List of cli-color styles to apply

method contents

contents: () => string;
  • Return the contents of this line as a string

method fill

fill: () => Line;
  • At the end of a line, fill the rest of the columns to the right edge

method output

output: () => Line;
  • Print the generated line of text to the console

method padding

padding: (width: number) => Line;
  • Output width characters of blank space

    Parameter width

    Number of characters to print

method store

store: () => void;
  • Store this line into the buffer

class LineBuffer

class LineBuffer {}

    constructor

    constructor(options: LineBufferOptions);
    • Creates an object for buffering a group of text lines and then outputting them

      Parameter options

      Values to build the buffer

    method addLine

    addLine: (line: Line) => void;
    • Put a Line object into the LineBuffer

      Parameter line

      The line object to put into the buffer

    method fill

    fill: () => void;
    • If you don't have enough lines in the buffer, this will fill the reset of the lines with empty spaces

    method height

    height: () => number;
    • Return the height of the LineBuffer, when specified as console

    method output

    output: () => void;
    • Draw the LineBuffer to screen

    method width

    width: () => number;
    • Return the width of the LineBuffer, when specified as console

    class Progress

    class Progress {}

      constructor

      constructor(length: number);
      • Creates a progress bar

        Parameter length

        The desired length of the progress bar in characters

      method update

      update: (currentValueOrPercent: number, maxValue?: number) => string;
      • Returns the progress bar min/max context to write to stdout

        Parameter currentValueOrPercent

        Current value (or percent) of the progress bar

        Parameter maxValue

        Maximum value of the progress bar

      class Spinner

      class Spinner {}

        constructor

        constructor(statusText: string, style?: string[]);
        • Creates a new spinner

          Parameter statusText

          The default text to display while the spinner is spinning

          Parameter style

          Array of graphical characters used to draw the spinner

        method message

        message: (statusMessage: string) => void;
        • Update the status message that follows the spinner

          Parameter statusMessage

          Message to be displayed

        method start

        start: () => void;
        • Show the spinner on the screen

        method stop

        stop: () => void;
        • Erase the spinner from the screen

        Interfaces

        interface LineBufferOptions

        interface LineBufferOptions {}

          property height

          height?: number | 'console' | undefined;

            property scroll

            scroll?: number | undefined;

              property width

              width?: number | 'console' | undefined;

                property x

                x?: number | undefined;

                  property y

                  y?: number | undefined;

                    Package Files (1)

                    Dependencies (1)

                    Dev Dependencies (0)

                    No dev dependencies.

                    Peer Dependencies (0)

                    No peer dependencies.

                    Badge

                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/clui.

                    • Markdown
                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/clui)
                    • HTML
                      <a href="https://www.jsdocs.io/package/@types/clui"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>