module RemiLib::Console

Overview

The RemiLib::Console module provides various terminal-related functionality.

Extended Modules

Defined in:

remilib/console/ansi.cr
remilib/console/console.cr
remilib/console/progress-bar.cr
remilib/console/terminology.cr

Class Method Summary

Instance Method Summary

Class Method Detail

def self.askYesNo(question : String, needFull : Bool = false, *, input : IO = STDIN, output : IO = STDOUT) : Bool #

Prints question, then waits for the user to respond. If needFull is true, then the user must respond with the full words yes or no. If needFull is false (the default), then they can respond with y, yes, n, or no.

This returns true if the user responded in the affirmitive, or false otherwise.


[View source]

Instance Method Detail

def auxCtrl(strm : IO, turnOn : Bool = true) : IO #

[View source]
def cursor(strm : IO, cells : UInt32, dir : Direction) : IO #

Moves the cursor by the given number of cells.


[View source]
def cursor(strm : IO, row : UInt32, col : UInt32) : IO #

Moves the cursor to the given row and column.


[View source]
def cursor(strm : IO, col : UInt32) : IO #

Moves the cursor to the given column in the current row.


[View source]
def defaultFont(strm : IO) : IO #

Switches the terminal to its default font.


[View source]
def endBold(strm : IO) : IO #

[View source]
def endColor(strm : IO) : IO #

[View source]
def endConceal(strm : IO) : IO #

[View source]
def endCrossedOut(strm : IO) : IO #

[View source]
def endEncircled(strm : IO) : IO #

[View source]
def endFaint(strm : IO) : IO #

[View source]
def endFastBlink(strm : IO) : IO #

[View source]
def endFraktur(strm : IO) : IO #

[View source]
def endFramed(strm : IO) : IO #

[View source]
def endItalic(strm : IO) : IO #

[View source]
def endOverlined(strm : IO) : IO #

[View source]
def endReverseVideo(strm : IO) : IO #

[View source]
def endSlowBlink(strm : IO) : IO #

[View source]
def endUnderline(strm : IO) : IO #

[View source]
def erase(strm : IO, from : EraseLine = EraseLine::CursorToEnd) #

Erases text from the terminal. from dictates how the erasing is done.


[View source]
def eraseScreen(strm : IO, from : EraseDisplay = EraseDisplay::CursorToEnd) #

Erases the screen. from dictates how the erasing is done.


[View source]
def font(strm : IO, fnt : UInt32) : IO #

Changes the terminal font.


[View source]
def getWinSize : Tuple(UInt16, UInt16) #

Gets the height and width of the terminal (in that order).


[View source]
def hideCursor(strm : IO) : IO #

Hides the cursor.


[View source]
def reset(strm : IO) : IO #

Resets the terminal.


[View source]
def restoreCursorPos(strm : IO) : IO #

Restores the cursor's position. See #saveCursorPos.


[View source]
def saveCursorPos(strm : IO) : IO #

Saves the cursor's position. See #restoreCursorPos.


[View source]
def scroll(strm : IO, lines : UInt32, down : Bool = false) : IO #

Scrolls the screen by the given number of lines.


[View source]
def setTitle(strm : IO, title : String) : IO #

Sets the terminal title.


[View source]
def showCursor(strm : IO) : IO #

Changes the cursor to visible.


[View source]
def startBold(strm : IO) : IO #

[View source]
def startColor(strm : IO, fg : Color, bg : Color = Color::Default) : IO #

[View source]
def startConceal(strm : IO) : IO #

[View source]
def startCrossedOut(strm : IO) : IO #

[View source]
def startEncircled(strm : IO) : IO #

[View source]
def startFaint(strm : IO) : IO #

[View source]
def startFastBlink(strm : IO) : IO #

[View source]
def startFraktur(strm : IO) : IO #

[View source]
def startFramed(strm : IO) : IO #

[View source]
def startItalic(strm : IO) : IO #

[View source]
def startOverlined(strm : IO) : IO #

[View source]
def startReverseVideo(strm : IO) : IO #

[View source]
def startSlowBlink(strm : IO) : IO #

[View source]
def startUnderline(strm : IO) : IO #

[View source]
def withBold(strm : IO, &) #

[View source]
def withColor(strm : IO, fg : Color, bg : Color = Color::Default, &) : IO #

[View source]
def withConceal(strm : IO, &) #

[View source]
def withCrossedOut(strm : IO, &) #

[View source]
def withEncircled(strm : IO, &) #

[View source]
def withFaint(strm : IO, &) #

[View source]
def withFastBlink(strm : IO, &) #

[View source]
def withFraktur(strm : IO, &) #

[View source]
def withFramed(strm : IO, &) #

[View source]
def withItalic(strm : IO, &) #

[View source]
def withOverlined(strm : IO, &) #

[View source]
def withProgress(label : String, max : Int | Float, output : IO = STDOUT, &) : Nil #

Creates a new RemiLib::Console::ProgressBar with the given parameters, then yields it to the block. A newline will be automatically printed once the block is finished by calling RemiLib::Console::ProgressBar#done.


[View source]
def withReverseVideo(strm : IO, &) #

[View source]
def withSlowBlink(strm : IO, &) #

[View source]
def withUnderline(strm : IO, &) #

[View source]