Documentation
¶
Index ¶
- func FormatBytes(c uint64) string
- func FormatDuration(d time.Duration) string
- func FormatPercent(numerator uint64, denominator uint64) string
- func FormatSeconds(sec uint64) string
- func ParseBytes(s string) (int64, error)
- func TerminalDisplayWidth(s string) int
- func ToJSONString(status interface{}) string
- type Message
- type MockTerminal
- type Terminal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatBytes ¶
func FormatDuration ¶
FormatDuration formats d as FormatSeconds would.
func FormatPercent ¶
FormatPercent formats numerator/denominator as a percentage.
func FormatSeconds ¶
FormatSeconds formats sec as MM:SS, or HH:MM:SS if sec seconds is at least an hour.
func ParseBytes ¶
ParseBytes parses a size in bytes from s. It understands the suffixes B, K, M, G and T for powers of 1024.
func TerminalDisplayWidth ¶ added in v0.17.0
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 ¶
NewMessage returns a message progress reporter with underlying terminal term.
func (*Message) P ¶
P prints a message if verbosity >= 1, this is used for normal messages which are not errors.
func (*Message) S ¶ added in v0.18.0
S prints a message, this is should only be used for very important messages that are not errors.
type MockTerminal ¶ added in v0.17.1
func (*MockTerminal) CanUpdateStatus ¶ added in v0.17.1
func (m *MockTerminal) CanUpdateStatus() bool
func (*MockTerminal) Error ¶ added in v0.17.1
func (m *MockTerminal) Error(line string)
func (*MockTerminal) Print ¶ added in v0.17.1
func (m *MockTerminal) Print(line string)
func (*MockTerminal) SetStatus ¶ added in v0.17.1
func (m *MockTerminal) SetStatus(lines []string)