utils

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 Contains

func Contains(s []string, e string) bool

Contains check if a slice contains a given string

func IsCI added in v1.3.0

func IsCI() bool

based on https://github.com/watson/ci-info/blob/HEAD/index.js

func IsCygwinTerminal

func IsCygwinTerminal(f *os.File) bool

func MakePath

func MakePath(path string) error

MakePath creates a path if it doesn't exist

func Pluralize

func Pluralize(num int, thing string) string

Pluralize returns the plural form of a given string

func SliceToReadableString added in v1.3.0

func SliceToReadableString(str []string) string

Convert slice of string to a readable string eg: ["one", "two", "three"] -> "one, two and three"

func SliceToString added in v1.2.1

func SliceToString(str []string) string

Convert slice of string to comma separated string

func StringToSlice added in v1.2.1

func StringToSlice(str string) []string

Convert comma separated string values to slice

func ToKebabCase

func ToKebabCase(str string) string

ToKebabCase converts a string to kebab case

Types

This section is empty.

Jump to

Keyboard shortcuts

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