Documentation ¶
Index ¶
- Variables
- func CanExpandHome(s string) bool
- func CreateLogDir(logDir, appName string) string
- func EnvSize(envName string, defaultValue int) int
- func Exit(msg string, code int)
- func ExitIfErr(err error)
- func ExpandHome(s string) string
- func GetGroupID() int64
- func IsRootGroup() bool
- func OpenBrowser(url string) bool
- func Remove(f string)
- func SleepContext(ctx context.Context, duration time.Duration)
- func WaitTimeout(cmd *exec.Cmd, timeout time.Duration) bool
- type ReadFileConfig
- type ReadFileConfigFn
- type ReadFileConfigFns
- type ReadFileResult
Constants ¶
This section is empty.
Variables ¶
View Source
var Home string
Functions ¶
func CanExpandHome ¶
func CreateLogDir ¶
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 ExpandHome ¶
func IsRootGroup ¶
func IsRootGroup() bool
IsRootGroup tells the current user's group is zero or not.
func OpenBrowser ¶
OpenBrowser go/src/cmd/internal/browser/browser.go
func WaitTimeout ¶
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 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 ¶
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
Click to show internal directories.
Click to hide internal directories.