utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VALID_PLATFORMS = []string{"windows", "linux", "osx", "android", "sunos"}

Possible valid platforms

Functions

func ColorOn

func ColorOn(level string) bool

Calculate wether colors should be enabled or not

func FsExists

func FsExists(path string) bool

exists returns whether the given file or directory exists

func IsAtty

func IsAtty() bool

wether stdout is terminal or not

func IsValidPlatform

func IsValidPlatform(plat string) bool

check if a platform is valid 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 Platform

func Platform() string

Get current platform name. Return common if unknown (shouldnt generally occur)

func ReadFile

func ReadFile(path string) (string, error)

read a file's content to string

func SafePlatform

func SafePlatform(plat string) string

convert plat to app friendly type

Types

This section is empty.

Jump to

Keyboard shortcuts

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