sily.bashfmt

Formatting and util to work with BASH

Members

Aliases

BG
alias BG = Background

Short alias to formatting enum

FG
alias FG = Foreground
FM
alias FM = Formatting
FR
alias FR = FormattingReset

Short alias to formatting enum

Enums

Background
enum Background

Contains escape sequences for background colors

Foreground
enum Foreground

Contains escape sequences for foreground colors

Formatting
enum Formatting

Contains escape sequences for string formatting (bold, italics)

FormattingReset
enum FormattingReset

Contains escape sequences to reset string formatting

Functions

bell
void bell()

Rings audio bell

cleanTerminalState
void cleanTerminalState()

Intended to be used in SIGINT callback Resets all formatting and shows cursor

cursorGetPosition
uvec2 cursorGetPosition()

Returns cursor position

cursorHide
void cursorHide()

Hides cursor. Does not reset position

cursorMoveDown
void cursorMoveDown(int lineAmount)

Moves cursor in terminal down by lineAmount

cursorMoveDownStart
void cursorMoveDownStart(int lineAmount)

Moves cursor in terminal down bylineAmount and sets cursor X to 1

cursorMoveHome
void cursorMoveHome()

Moves cursor in terminal to {1, 1}

cursorMoveLeft
void cursorMoveLeft(int columnAmount)

Moves cursor in terminal left by columnAmount

cursorMoveRight
void cursorMoveRight(int columnAmount)

Moves cursor in terminal right by columnAmount

cursorMoveTo
void cursorMoveTo(int x, int y)
void cursorMoveTo(uvec2 pos)
void cursorMoveTo(int x)

Moves cursor in terminal to {x, y} or to x. **COORDINATES START FROM 1**

cursorMoveUp
void cursorMoveUp(int lineAmount)

Moves cursor in terminal up by lineAmount

cursorMoveUpScroll
void cursorMoveUpScroll()

Moves cursor in terminal up by 1 and scrolls if needed

cursorMoveUpStart
void cursorMoveUpStart(int lineAmount)

Moves cursor in terminal up bylineAmount and sets cursor X to 1

cursorRestorePosition
void cursorRestorePosition()

Saves/Restores cursor position to be restored later (DEC)

cursorRestorePositionSCO
void cursorRestorePositionSCO()

Saves/Restores cursor position to be restored later (SCO). **PREFER DEC (saveCursorPosition) VERSION INSTEAD.**

cursorSavePosition
void cursorSavePosition()

Saves/Restores cursor position to be restored later (DEC)

cursorSavePositionSCO
void cursorSavePositionSCO()

Saves/Restores cursor position to be restored later (SCO). **PREFER DEC (saveCursorPosition) VERSION INSTEAD.**

cursorShow
void cursorShow()

Shows cursor. Does not reset position

eraseCurrentLine
void eraseCurrentLine()

Fully erases current line

eraseLineLeft
void eraseLineLeft()

Erases text from start of current line to cursor

eraseLineRight
void eraseLineRight()

Erases text from cursor to end of current line

eraseLines
void eraseLines(int num)

Erases num lines in terminal starting with current.

fwrite
void fwrite(A args)

Casts args to string and writes to stdout Intended to be used to print formatting

fwriteln
void fwriteln(A args)

Casts args to string and writes to stdout with \n at the end Intended to be used to print formatting

screenClear
void screenClear()

Clears terminal screen and resets cursor position

screenClearOnly
void screenClearOnly()

Clears terminal screen

screenDisableAltBuffer
void screenDisableAltBuffer()

Enabled/Disables alternative screen buffer.

screenEnableAltBuffer
void screenEnableAltBuffer()

Enabled/Disables alternative screen buffer.

screenHardReset
void screenHardReset()

Hard resets terminal. Not recommended to use

screenRestore
void screenRestore()

Enabled/Disables Alt Buffer. **PREFER screenEnableAltBuffer OR screenDisableAltBuffer INSTEAD.**

screenSave
void screenSave()

Enabled/Disables Alt Buffer. **PREFER screenEnableAltBuffer OR screenDisableAltBuffer INSTEAD.**

setTitle
void setTitle(string title)

Sets terminal title that's going to last until program termination

Meta