view

package
v0.0.0-...-df93409 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 31, 2014 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package view implements display-related functionality, such as data formatting and display updates (using termbox).

Index

Constants

View Source
const (
	KB float64 = 1 << (10 * iota)
	MB
	GB
	TB
)

Declare size interval constants.

Variables

This section is empty.

Functions

func Close

func Close()

Close is used to relinquish the screen so that it can be used after the program exits.

func FormatRow

func FormatRow(row Row, size int) (string, error)

FormatRow returns a string with the row's left/right elements placed at the far left/right with spaces in between.

func Height

func Height() int

func Initialize

func Initialize()

Initialize prepares the screen for rendering, and should only be run once, before constructing a new view.

func New

func New(buffers <-chan *Buffer)

Construct a view that will listen for and render buffers sent to it. Initialize and Close must be called before and after this function, respectively.

func Size

func Size(sizeInBytes int64) (formattedSize string)

Given a size in bytes, generates a presentable string in the unit most appropriate for the number of bytes.

Types

type Buffer

type Buffer struct {
	Rows   []Row
	Status [2]string
}

Buffer encapsulates all of the data required to render the view.

type Row

type Row struct {
	Left      string
	Right     string
	Highlight bool
	Colour    bool
}

Encapsulates information require to draw a row of information.

Left and right represent two columns with matching alignment. Highlight inverts the row's colours, useful for "selecting" a row.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL