ascii-progress-0.2.1.0: A simple progress bar for the console.

Safe HaskellNone
LanguageHaskell2010

System.Console.AsciiProgress

Synopsis

Documentation

data Options Source

The progress bar's options.

Constructors

Options 

Fields

pgFormat :: String

A format string for the progress bar. Currently the following format strings are supported: - ":eta" (ETA displayed in seconds) - ":current" (current tick) - ":total" (total number of ticks) - ":percent" (percentage completed) - ":elapsed" (elapsed time in seconds) - ":bar" (the actual progress bar)

pgCompletedChar :: Char

Character to be used on the completed part of the bar

pgPendingChar :: Char

Character to be used on the pending part of the bar

pgTotal :: Int

Total amount of ticks expected

pgWidth :: Int

The progress bar's width

pgOnCompletion :: IO ()

An IO action to be executed on completion, with the cursor set at progress bar's line

Instances

data Stats Source

Represents a point in time for the progress bar.

Constructors

Stats 

isComplete :: ProgressBar -> IO Bool Source

Returns if the progress bar rendering thread has exited (it has done enough ticks)

newProgressBar :: Options -> IO ProgressBar Source

Creates a new progress bar with the given Options. Multiple progress bars may be created as long as everytime a line is outputted by your program, while progress bars run is followed by a call to registerLn

complete :: ProgressBar -> IO () Source

Forces a ProgressBar to finish

tick :: ProgressBar -> IO () Source

Tick the progress bar

tickN :: ProgressBar -> Int -> IO () Source

Tick the progress bar N times

getProgressStrIO :: ProgressBar -> IO String Source

Like getProgressStr but works on the ProgressBar object and uses the IO monad.

getProgressStats :: ProgressBar -> IO Stats Source

Gets the progress bar current Stats object

getProgressStr :: Options -> Stats -> String Source

Gets the string to be printed given the options object and a certain stats object representing the rendering moment.

registerLn :: IO () Source

Registers a new line for multiple progress bars

class Default a where

A class for types with a default value.

Methods

def :: a

The default value for this type.

Instances