osx

package
v0.0.0-...-e8daaa7 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 12 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Home string

Functions

func CanExpandHome

func CanExpandHome(s string) bool

func CreateLogDir

func CreateLogDir(logDir, appName string) string

CreateLogDir creates a log path. If logDir is empty, /var/log/{appName} or ~/logs/{appName} will used as logDir. If appName is empty, os.Args[0]'s base will be use as appName.

func EnvSize

func EnvSize(envName string, defaultValue int) int

func Exit

func Exit(msg string, code int)

func ExitIfErr

func ExitIfErr(err error)

func ExpandHome

func ExpandHome(s string) string

func GetGroupID

func GetGroupID() int64

GetGroupID the current user's group ID.

func IsRootGroup

func IsRootGroup() bool

IsRootGroup tells the current user's group is zero or not.

func OpenBrowser

func OpenBrowser(url string) bool

OpenBrowser go/src/cmd/internal/browser/browser.go

func Remove

func Remove(f string)

func SleepContext

func SleepContext(ctx context.Context, duration time.Duration)

func WaitTimeout

func WaitTimeout(cmd *exec.Cmd, timeout time.Duration) bool

WaitTimeout reports whether the command appears to have run successfully. If the command runs longer than the timeout, it's deemed successful. If the command runs within the timeout, it's deemed successful if it exited cleanly.

Types

type ReadFileConfig

type ReadFileConfig struct {
	AutoUncompress bool
	FatalOnError   bool
}

type ReadFileConfigFn

type ReadFileConfigFn func(*ReadFileConfig)

func WithAutoUncompress

func WithAutoUncompress(v bool) ReadFileConfigFn

func WithFatalOnError

func WithFatalOnError(v bool) ReadFileConfigFn

type ReadFileConfigFns

type ReadFileConfigFns []ReadFileConfigFn

func (ReadFileConfigFns) Create

func (fns ReadFileConfigFns) Create() (config ReadFileConfig)

type ReadFileResult

type ReadFileResult struct {
	Data []byte
	Err  error
}

func ReadFile

func ReadFile(filename string, fns ...ReadFileConfigFn) (rr ReadFileResult)

ReadFile reads a file content, if it's a .gz, decompress it.

func (ReadFileResult) OK

func (r ReadFileResult) OK() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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