module RemiLib::Console
Overview
The RemiLib::Console
module provides various terminal-related functionality.
Extended Modules
Defined in:
remilib/console/ansi.crremilib/console/console.cr
remilib/console/progress-bar.cr
remilib/console/terminology.cr
Class Method Summary
-
.askYesNo(question : String, needFull : Bool = false, *, input : IO = STDIN, output : IO = STDOUT) : Bool
Prints
question
, then waits for the user to respond.
Instance Method Summary
- #auxCtrl(strm : IO, turnOn : Bool = true) : IO
-
#cursor(strm : IO, cells : UInt32, dir : Direction) : IO
Moves the cursor by the given number of cells.
-
#cursor(strm : IO, row : UInt32, col : UInt32) : IO
Moves the cursor to the given row and column.
-
#cursor(strm : IO, col : UInt32) : IO
Moves the cursor to the given column in the current row.
-
#defaultFont(strm : IO) : IO
Switches the terminal to its default font.
- #endBold(strm : IO) : IO
- #endColor(strm : IO) : IO
- #endConceal(strm : IO) : IO
- #endCrossedOut(strm : IO) : IO
- #endEncircled(strm : IO) : IO
- #endFaint(strm : IO) : IO
- #endFastBlink(strm : IO) : IO
- #endFraktur(strm : IO) : IO
- #endFramed(strm : IO) : IO
- #endItalic(strm : IO) : IO
- #endOverlined(strm : IO) : IO
- #endReverseVideo(strm : IO) : IO
- #endSlowBlink(strm : IO) : IO
- #endUnderline(strm : IO) : IO
-
#erase(strm : IO, from : EraseLine = EraseLine::CursorToEnd)
Erases text from the terminal.
-
#eraseScreen(strm : IO, from : EraseDisplay = EraseDisplay::CursorToEnd)
Erases the screen.
-
#font(strm : IO, fnt : UInt32) : IO
Changes the terminal font.
-
#getWinSize : Tuple(UInt16, UInt16)
Gets the height and width of the terminal (in that order).
-
#hideCursor(strm : IO) : IO
Hides the cursor.
-
#reset(strm : IO) : IO
Resets the terminal.
-
#restoreCursorPos(strm : IO) : IO
Restores the cursor's position.
-
#saveCursorPos(strm : IO) : IO
Saves the cursor's position.
-
#scroll(strm : IO, lines : UInt32, down : Bool = false) : IO
Scrolls the screen by the given number of lines.
-
#setTitle(strm : IO, title : String) : IO
Sets the terminal title.
-
#showCursor(strm : IO) : IO
Changes the cursor to visible.
- #startBold(strm : IO) : IO
- #startColor(strm : IO, fg : Color, bg : Color = Color::Default) : IO
- #startConceal(strm : IO) : IO
- #startCrossedOut(strm : IO) : IO
- #startEncircled(strm : IO) : IO
- #startFaint(strm : IO) : IO
- #startFastBlink(strm : IO) : IO
- #startFraktur(strm : IO) : IO
- #startFramed(strm : IO) : IO
- #startItalic(strm : IO) : IO
- #startOverlined(strm : IO) : IO
- #startReverseVideo(strm : IO) : IO
- #startSlowBlink(strm : IO) : IO
- #startUnderline(strm : IO) : IO
- #withBold(strm : IO, &)
- #withColor(strm : IO, fg : Color, bg : Color = Color::Default, &) : IO
- #withConceal(strm : IO, &)
- #withCrossedOut(strm : IO, &)
- #withEncircled(strm : IO, &)
- #withFaint(strm : IO, &)
- #withFastBlink(strm : IO, &)
- #withFraktur(strm : IO, &)
- #withFramed(strm : IO, &)
- #withItalic(strm : IO, &)
- #withOverlined(strm : IO, &)
-
#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. - #withReverseVideo(strm : IO, &)
- #withSlowBlink(strm : IO, &)
- #withUnderline(strm : IO, &)
Class Method Detail
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.
Instance Method Detail
Moves the cursor by the given number of cells.
Moves the cursor to the given row and column.
Moves the cursor to the given column in the current row.
Erases text from the terminal. from
dictates how the erasing is done.
Erases the screen. from
dictates how the erasing is done.
Gets the height and width of the terminal (in that order).
Restores the cursor's position. See #saveCursorPos
.
Saves the cursor's position. See #restoreCursorPos
.
Scrolls the screen by the given number of lines.
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
.