dr-cabal-0.2.0.0: See README for more info
Copyright(c) 2022 Dmitrii Kovanikov
LicenseMPL-2.0
MaintainerDmitrii Kovanikov <kovanikov@gmail.com>
StabilityExperimental
PortabilityPortable
Safe HaskellSafe-Inferred
LanguageHaskell2010

DrCabal.Terminal

Description

Utility functions to work with the terminal output.

Synopsis

Documentation

getTerminalWidth :: IO Int Source #

Get the width of the current terminal.

This function exits the process with the message if it can't get the width of the current terminal.

clearScreen :: Int -> IO () Source #

Clears the the screenHeight number of lines in the screen. Pass the number of lines in the output to clear the entire screen.

withAlternateBuffer :: IO a -> IO a Source #

Run action in the alternate buffer and return to the normal screen after exception or SIGINT.

NOTE: This function always returns to the normal screen after the action. If you want to print something to the normal screen use the result of the given action afterwards.