ui

package
v0.0.0-...-0265167 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBytes

func FormatBytes(c uint64) string

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats d as FormatSeconds would.

func FormatPercent

func FormatPercent(numerator uint64, denominator uint64) string

FormatPercent formats numerator/denominator as a percentage.

func FormatSeconds

func FormatSeconds(sec uint64) string

FormatSeconds formats sec as MM:SS, or HH:MM:SS if sec seconds is at least an hour.

func ParseBytes

func ParseBytes(s string) (int64, error)

ParseBytes parses a size in bytes from s. It understands the suffixes B, K, M, G and T for powers of 1024.

func TerminalDisplayWidth

func TerminalDisplayWidth(s string) int

TerminalDisplayWidth returns the number of terminal cells needed to display s

func ToJSONString

func ToJSONString(status interface{}) string

Types

type Message

type Message struct {
	// contains filtered or unexported fields
}

Message reports progress with messages of different verbosity.

func NewMessage

func NewMessage(term *termstatus.Terminal, verbosity uint) *Message

NewMessage returns a message progress reporter with underlying terminal term.

func (*Message) E

func (m *Message) E(msg string, args ...interface{})

E reports an error

func (*Message) P

func (m *Message) P(msg string, args ...interface{})

P prints a message if verbosity >= 1, this is used for normal messages which are not errors.

func (*Message) V

func (m *Message) V(msg string, args ...interface{})

V prints a message if verbosity >= 2, this is used for verbose messages.

func (*Message) VV

func (m *Message) VV(msg string, args ...interface{})

VV prints a message if verbosity >= 3, this is used for debug messages.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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