Skip to content

@toolcog/util/tty

Toolcog utilities

Interfaces

Style

Properties

bgBlack

readonly bgBlack: Stylized

Defined in

packages/framework/util/tty/src/style.ts:87

bgBlue

readonly bgBlue: Stylized

Defined in

packages/framework/util/tty/src/style.ts:91

bgBlueBright

readonly bgBlueBright: Stylized

Defined in

packages/framework/util/tty/src/style.ts:100

bgCyan

readonly bgCyan: Stylized

Defined in

packages/framework/util/tty/src/style.ts:93

bgCyanBright

readonly bgCyanBright: Stylized

Defined in

packages/framework/util/tty/src/style.ts:102

bgGray

readonly bgGray: Stylized

Defined in

packages/framework/util/tty/src/style.ts:95

bgGreen

readonly bgGreen: Stylized

Defined in

packages/framework/util/tty/src/style.ts:89

bgGreenBright

readonly bgGreenBright: Stylized

Defined in

packages/framework/util/tty/src/style.ts:98

bgMagenta

readonly bgMagenta: Stylized

Defined in

packages/framework/util/tty/src/style.ts:92

bgMagentaBright

readonly bgMagentaBright: Stylized

Defined in

packages/framework/util/tty/src/style.ts:101

bgRed

readonly bgRed: Stylized

Defined in

packages/framework/util/tty/src/style.ts:88

bgRedBright

readonly bgRedBright: Stylized

Defined in

packages/framework/util/tty/src/style.ts:97

bgWhite

readonly bgWhite: Stylized

Defined in

packages/framework/util/tty/src/style.ts:94

bgWhiteBright

readonly bgWhiteBright: Stylized

Defined in

packages/framework/util/tty/src/style.ts:103

bgYellow

readonly bgYellow: Stylized

Defined in

packages/framework/util/tty/src/style.ts:90

bgYellowBright

readonly bgYellowBright: Stylized

Defined in

packages/framework/util/tty/src/style.ts:99

black

readonly black: Stylized

Defined in

packages/framework/util/tty/src/style.ts:69

blue

readonly blue: Stylized

Defined in

packages/framework/util/tty/src/style.ts:73

blueBright

readonly blueBright: Stylized

Defined in

packages/framework/util/tty/src/style.ts:82

bold

readonly bold: Stylized

Defined in

packages/framework/util/tty/src/style.ts:60

cyan

readonly cyan: Stylized

Defined in

packages/framework/util/tty/src/style.ts:75

cyanBright

readonly cyanBright: Stylized

Defined in

packages/framework/util/tty/src/style.ts:84

dim

readonly dim: Stylized

Defined in

packages/framework/util/tty/src/style.ts:61

gray

readonly gray: Stylized

Defined in

packages/framework/util/tty/src/style.ts:77

green

readonly green: Stylized

Defined in

packages/framework/util/tty/src/style.ts:71

greenBright

readonly greenBright: Stylized

Defined in

packages/framework/util/tty/src/style.ts:80

hidden

readonly hidden: Stylized

Defined in

packages/framework/util/tty/src/style.ts:66

inverse

readonly inverse: Stylized

Defined in

packages/framework/util/tty/src/style.ts:65

italic

readonly italic: Stylized

Defined in

packages/framework/util/tty/src/style.ts:62

magenta

readonly magenta: Stylized

Defined in

packages/framework/util/tty/src/style.ts:74

magentaBright

readonly magentaBright: Stylized

Defined in

packages/framework/util/tty/src/style.ts:83

overline

readonly overline: Stylized

Defined in

packages/framework/util/tty/src/style.ts:64

red

readonly red: Stylized

Defined in

packages/framework/util/tty/src/style.ts:70

redBright

readonly redBright: Stylized

Defined in

packages/framework/util/tty/src/style.ts:79

reset

readonly reset: Stylized

Defined in

packages/framework/util/tty/src/style.ts:59

strikethrough

readonly strikethrough: Stylized

Defined in

packages/framework/util/tty/src/style.ts:67

underline

readonly underline: Stylized

Defined in

packages/framework/util/tty/src/style.ts:63

white

readonly white: Stylized

Defined in

packages/framework/util/tty/src/style.ts:76

whiteBright

readonly whiteBright: Stylized

Defined in

packages/framework/util/tty/src/style.ts:85

yellow

readonly yellow: Stylized

Defined in

packages/framework/util/tty/src/style.ts:72

yellowBright

readonly yellowBright: Stylized

Defined in

packages/framework/util/tty/src/style.ts:81


Styled()

Extends

Styled(text): string

Parameters

text: string

Returns

string

Defined in

packages/framework/util/tty/src/style.ts:5

Properties

close

readonly close: string

Defined in

packages/framework/util/tty/src/style.ts:10

closeCode

readonly closeCode: number

Defined in

packages/framework/util/tty/src/style.ts:7

open

readonly open: string

Defined in

packages/framework/util/tty/src/style.ts:9

openCode

readonly openCode: number

Defined in

packages/framework/util/tty/src/style.ts:6


Stylized()

Extended by

Stylized(text): string

Parameters

text: string

Returns

string

Defined in

packages/framework/util/tty/src/style.ts:2


WrapState

Properties

closeCode?

optional closeCode: number

Defined in

packages/framework/util/tty/src/wrap.ts:105

openCode?

optional openCode: number

Defined in

packages/framework/util/tty/src/wrap.ts:104

url?

optional url: string

Defined in

packages/framework/util/tty/src/wrap.ts:106

Variables

ansiRegex

const ansiRegex: RegExp

Defined in

packages/framework/util/tty/src/ansi.ts:2


beep

const beep: string = "\x07"

Defined in

packages/framework/util/tty/src/ansi.ts:65


clearScreen

const clearScreen: string = "\x1Bc"

Defined in

packages/framework/util/tty/src/ansi.ts:63


cursorGetPosition

const cursorGetPosition: string = "\x1B[6n"

Defined in

packages/framework/util/tty/src/ansi.ts:37


cursorHide

const cursorHide: string = "\x1B[?25l"

Defined in

packages/framework/util/tty/src/ansi.ts:40


cursorLeft

const cursorLeft: string = "\x1B[G"

Defined in

packages/framework/util/tty/src/ansi.ts:36


cursorNextLine

const cursorNextLine: string = "\x1B[E"

Defined in

packages/framework/util/tty/src/ansi.ts:38


cursorPrevLine

const cursorPrevLine: string = "\x1B[F"

Defined in

packages/framework/util/tty/src/ansi.ts:39


cursorShow

const cursorShow: string = "\x1B[?25h"

Defined in

packages/framework/util/tty/src/ansi.ts:41


eraseDown

const eraseDown: string = "\x1B[J"

Defined in

packages/framework/util/tty/src/ansi.ts:57


eraseEndLine

const eraseEndLine: string = "\x1B[K"

Defined in

packages/framework/util/tty/src/ansi.ts:54


eraseLine

const eraseLine: string = "\x1B[2K"

Defined in

packages/framework/util/tty/src/ansi.ts:56


eraseScreen

const eraseScreen: string = "\x1B[2J"

Defined in

packages/framework/util/tty/src/ansi.ts:59


eraseStartLine

const eraseStartLine: string = "\x1B[1K"

Defined in

packages/framework/util/tty/src/ansi.ts:55


eraseUp

const eraseUp: string = "\x1B[1J"

Defined in

packages/framework/util/tty/src/ansi.ts:58


scrollDown

const scrollDown: string = "\x1B[T"

Defined in

packages/framework/util/tty/src/ansi.ts:61


scrollUp

const scrollUp: string = "\x1B[S"

Defined in

packages/framework/util/tty/src/ansi.ts:60


style

style: object

Type declaration

bgBlack

readonly bgBlack: Styled

bgBlue

readonly bgBlue: Styled

bgBlueBright

readonly bgBlueBright: Styled

bgCyan

readonly bgCyan: Styled

bgCyanBright

readonly bgCyanBright: Styled

bgGray

readonly bgGray: Styled

bgGreen

readonly bgGreen: Styled

bgGreenBright

readonly bgGreenBright: Styled

bgMagenta

readonly bgMagenta: Styled

bgMagentaBright

readonly bgMagentaBright: Styled

bgRed

readonly bgRed: Styled

bgRedBright

readonly bgRedBright: Styled

bgWhite

readonly bgWhite: Styled

bgWhiteBright

readonly bgWhiteBright: Styled

bgYellow

readonly bgYellow: Styled

bgYellowBright

readonly bgYellowBright: Styled

black

readonly black: Styled

blue

readonly blue: Styled

blueBright

readonly blueBright: Styled

bold

readonly bold: Styled

cyan

readonly cyan: Styled

cyanBright

readonly cyanBright: Styled

dim

readonly dim: Styled

gray

readonly gray: Styled

green

readonly green: Styled

greenBright

readonly greenBright: Styled

hidden

readonly hidden: Styled

inverse

readonly inverse: Styled

italic

readonly italic: Styled

magenta

readonly magenta: Styled

magentaBright

readonly magentaBright: Styled

overline

readonly overline: Styled

red

readonly red: Styled

redBright

readonly redBright: Styled

reset

readonly reset: Styled

strikethrough

readonly strikethrough: Styled

underline

readonly underline: Styled

white

readonly white: Styled

whiteBright

readonly whiteBright: Styled

yellow

readonly yellow: Styled

yellowBright

readonly yellowBright: Styled

Defined in

packages/framework/util/tty/src/style.ts:106


unstyle

const unstyle: object

Type declaration

bgBlack

readonly bgBlack: Stylized = unstyled

bgBlue

readonly bgBlue: Stylized = unstyled

bgBlueBright

readonly bgBlueBright: Stylized = unstyled

bgCyan

readonly bgCyan: Stylized = unstyled

bgCyanBright

readonly bgCyanBright: Stylized = unstyled

bgGray

readonly bgGray: Stylized = unstyled

bgGreen

readonly bgGreen: Stylized = unstyled

bgGreenBright

readonly bgGreenBright: Stylized = unstyled

bgMagenta

readonly bgMagenta: Stylized = unstyled

bgMagentaBright

readonly bgMagentaBright: Stylized = unstyled

bgRed

readonly bgRed: Stylized = unstyled

bgRedBright

readonly bgRedBright: Stylized = unstyled

bgWhite

readonly bgWhite: Stylized = unstyled

bgWhiteBright

readonly bgWhiteBright: Stylized = unstyled

bgYellow

readonly bgYellow: Stylized = unstyled

bgYellowBright

readonly bgYellowBright: Stylized = unstyled

black

readonly black: Stylized = unstyled

blue

readonly blue: Stylized = unstyled

blueBright

readonly blueBright: Stylized = unstyled

bold

readonly bold: Stylized = unstyled

cyan

readonly cyan: Stylized = unstyled

cyanBright

readonly cyanBright: Stylized = unstyled

dim

readonly dim: Stylized = unstyled

gray

readonly gray: Stylized = unstyled

green

readonly green: Stylized = unstyled

greenBright

readonly greenBright: Stylized = unstyled

hidden

readonly hidden: Stylized = unstyled

inverse

readonly inverse: Stylized = unstyled

italic

readonly italic: Stylized = unstyled

magenta

readonly magenta: Stylized = unstyled

magentaBright

readonly magentaBright: Stylized = unstyled

overline

readonly overline: Stylized = unstyled

red

readonly red: Stylized = unstyled

redBright

readonly redBright: Stylized = unstyled

reset

readonly reset: Stylized = unstyled

strikethrough

readonly strikethrough: Stylized = unstyled

underline

readonly underline: Stylized = unstyled

white

readonly white: Stylized = unstyled

whiteBright

readonly whiteBright: Stylized = unstyled

yellow

readonly yellow: Stylized = unstyled

yellowBright

readonly yellowBright: Stylized = unstyled

Defined in

packages/framework/util/tty/src/style.ts:160

Functions

cursorBackward()

cursorBackward(count): string

Parameters

count: number = 1

Returns

string

Defined in

packages/framework/util/tty/src/ansi.ts:34


cursorDown()

cursorDown(count): string

Parameters

count: number = 1

Returns

string

Defined in

packages/framework/util/tty/src/ansi.ts:32


cursorForward()

cursorForward(count): string

Parameters

count: number = 1

Returns

string

Defined in

packages/framework/util/tty/src/ansi.ts:33


cursorMove()

cursorMove(x, y?): string

Parameters

x: number

y?: number

Returns

string

Defined in

packages/framework/util/tty/src/ansi.ts:14


cursorTo()

cursorTo(x, y?): string

Parameters

x: number

y?: number

Returns

string

Defined in

packages/framework/util/tty/src/ansi.ts:7


cursorUp()

cursorUp(count): string

Parameters

count: number = 1

Returns

string

Defined in

packages/framework/util/tty/src/ansi.ts:31


ellipsize()

ellipsize(text, maxWidth, direction?, ellipsis?): string

Parameters

text: string

maxWidth: number

direction?: number

ellipsis?: string = "..."

Returns

string

Defined in

packages/framework/util/tty/src/ellipsize.ts:100


ellipsizeEnd()

ellipsizeEnd(text, maxWidth, ellipsis): string

Parameters

text: string

maxWidth: number

ellipsis: string = "..."

Returns

string

Defined in

packages/framework/util/tty/src/ellipsize.ts:52


ellipsizeStart()

ellipsizeStart(text, maxWidth, ellipsis): string

Parameters

text: string

maxWidth: number

ellipsis: string = "..."

Returns

string

Defined in

packages/framework/util/tty/src/ellipsize.ts:4


eraseLines()

eraseLines(count): string

Parameters

count: number

Returns

string

Defined in

packages/framework/util/tty/src/ansi.ts:43


getCharacterWidth()

getCharacterWidth(codePoint, character?): number

Parameters

codePoint: number

character?: string

Returns

number

Defined in

packages/framework/util/tty/src/width.ts:3


getStringWidth()

getStringWidth(text): number

Parameters

text: string

Returns

number

Defined in

packages/framework/util/tty/src/width.ts:221


link(text, url): string

Parameters

text: string

url: string

Returns

string

Defined in

packages/framework/util/tty/src/ansi.ts:67


stripAnsi()

stripAnsi(text): string

Parameters

text: string

Returns

string

Defined in

packages/framework/util/tty/src/ansi.ts:5


stylize()

stylize(enabled): Style

Parameters

enabled: boolean | () => boolean

Returns

Style

Defined in

packages/framework/util/tty/src/style.ts:212


wrapLine()

wrapLine(input, maxWidth, eol, state): string

Parameters

input: string

maxWidth: number

eol: string

state: WrapState = {}

Returns

string

Defined in

packages/framework/util/tty/src/wrap.ts:109


wrapLines()

wrapLines(input, maxWidth): string[]

Parameters

input: string

maxWidth: number

Returns

string[]

Defined in

packages/framework/util/tty/src/wrap.ts:242


wrapText()

wrapText(input, maxWidth): string

Parameters

input: string

maxWidth: number

Returns

string

Defined in

packages/framework/util/tty/src/wrap.ts:257