utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Anyhow

func Anyhow(errs ...interface{}) error

concat multiple strings/errors into a single error

func EnsureDir

func EnsureDir(path string) error

create directory at path if it doesnt exist

func EnsureFile

func EnsureFile(path string, content string) error

create file at path if it doesnt exist

func IsAtty

func IsAtty() bool

wether stdout is terminal or not

func Must

func Must[T any](val T, err error) T

panic if err, else return val

func MustB

func MustB[T any](val T, err error) bool

similar to must but returns true always if theres no err. For err it just panics

func ParseColorLevel

func ParseColorLevel(lvl string) bool

wether to allow color or not based on - valid levels: always, auto, never

func PathExists

func PathExists(path string) bool

exists returns whether the given file or directory exists

func ReadFile

func ReadFile(path string) (string, error)

read a file's content to string

func SetColor

func SetColor(lvl string)

Set color

Types

This section is empty.

Directories

Path Synopsis
Package for finding directories and files related to the app
Package for finding directories and files related to the app

Jump to

Keyboard shortcuts

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