Ƭ ForEachMessageCallback: function
▸ (message: Message‹Meta›, name: string, allMessages: MessageMap‹Meta›): void
Parameters:
| Name | Type |
|---|---|
message |
Message‹Meta› |
name |
string |
allMessages |
MessageMap‹Meta› |
Ƭ MessageMap: Map‹string, Message‹Meta››
Ƭ NoMeta: undefined
Const sharedCursor• sharedCursor: Cursor = createCursor()
Const sharedStdinMuter• sharedStdinMuter: undefined | Muter = createStdinMuter()
▸ createCursor(): Cursor
Returns an object capable of showing and hiding the CLI cursor.
remarks This is a thin wrapper around cli-cursor.
Returns: Cursor
▸ createSpinnerLoop(spinner: Spinner): SpinnerLoop
Returns an object capable of managing setInterval calls related to a spinner.
remarks This implementation was based on code from spinnies (MIT).
Parameters:
| Name | Type |
|---|---|
spinner |
Spinner |
Returns: SpinnerLoop
▸ createStdinMuter(): Muter | undefined
Returns an object capable of muting stdin output.
remarks This implementation was based on StdinDiscarder from ora (MIT).
Returns: Muter | undefined
▸ defaultRender‹Meta›(message: Message‹Meta›, frame: string | null): string
The function used to render messages if a render function is not defined by the Message object.
Type parameters:
▪ Meta
Parameters:
| Name | Type |
|---|---|
message |
Message‹Meta› |
frame |
string | null |
Returns: string
▸ tabStop(input: string[], columns: number): string
Simulate tab stops using spaces
remarks tabStop can be used instead of actual tabs to sidestep a TTY quirk.
When Twisters overwrites a line of text, it only clears from the end of the new text to the end of the terminal line (as opposed to clearing the entire line before writing which can cause a flickering effect).
When a tab (\t) character is written to the stream, the cursor advances without
overwriting the text, which can cause garbage text to remain on the line in some cases.
Use tabStop to create the illusion of regular tab breaks by inserting the
required number of spaces (assumes 8 character wide tab stop by default).
example util/tab-stop.js
tabStop(line.split('\t'));
Parameters:
| Name | Type | Default |
|---|---|---|
input |
string[] | - |
columns |
number | 8 |
Returns: string
▸ terminalSupportsUnicode(): boolean
The default command prompt and PowerShell in Windows do not support Unicode characters. However, the VS Code integrated terminal and the Windows Terminal both do, so this function takes the TERM_PROGRAM and WT_SESSION environment variables into account.
remarks This implementation was extracted from spinnies (MIT).
Returns: boolean
▸ wrapText(text: string, columns: number, wordWrap: boolean): string
Wrap text to the specified column width by inserting line breaks.
remarks This is a thin wrapper around wrap-ansi.
Parameters:
| Name | Type | Default |
|---|---|---|
text |
string | - |
columns |
number | 80 |
wordWrap |
boolean | false |
Returns: string
Const dashes• frames: string[] = ['-', '_']
• interval: number = 80
Const dots• frames: string[] = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
• interval: number = 50