utils

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IsTerminal = func(f *os.File) bool {
	return isatty.IsTerminal(f.Fd()) || IsCygwinTerminal(f)
}
View Source
var TerminalSize = func(w interface{}) (int, int, error) {
	if f, isFile := w.(*os.File); isFile {
		return term.GetSize(int(f.Fd()))
	}

	return 0, 0, fmt.Errorf("%v is not a file", w)
}

Functions

func DisplayURL added in v0.11.1

func DisplayURL(urlStr string) string

func FuzzyAgo

func FuzzyAgo(ago time.Duration) string

func FuzzyAgoAbbr added in v1.4.0

func FuzzyAgoAbbr(now time.Time, createdAt time.Time) string

func Humanize added in v0.6.2

func Humanize(s string) string

func IsCygwinTerminal added in v0.11.0

func IsCygwinTerminal(f *os.File) bool

func IsURL added in v0.11.1

func IsURL(s string) bool

func Pluralize

func Pluralize(num int, thing string) string

func ValidURL added in v1.8.0

func ValidURL(urlStr string) bool

Maximum length of a URL: 8192 bytes

Types

type TablePrinter

type TablePrinter interface {
	IsTTY() bool
	AddField(string, func(int, string) string, func(string) string)
	EndRow()
	Render() error
}

func NewTablePrinter

func NewTablePrinter(io *iostreams.IOStreams) TablePrinter

Jump to

Keyboard shortcuts

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