util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChownDirectory

func ChownDirectory(dir string, userId int, groupId int) (int, error)

func ExecCommand

func ExecCommand(cmd ...string) (string, error)

func FormatDuration

func FormatDuration(duration time.Duration) string

func GetAbsoluteDir

func GetAbsoluteDir(relPath string, userName string) (string, error)

func GetRunType

func GetRunType(headless bool) string

func HttpGet

func HttpGet(endpoint string, params map[string]string) ([]byte, error)

func IsDirectory

func IsDirectory(str string) bool

func IsExecutable

func IsExecutable(str string) bool

func IsGitRepository

func IsGitRepository(str string) bool

func IsReadableFile

func IsReadableFile(str string) bool

func PathExists added in v1.1.0

func PathExists(str string) bool

func Pluralise

func Pluralise(n int, singular, plural string) string

func SendMail

func SendMail(name, email, subject, body string) error

Types

type ExecContext

type ExecContext struct {
	// contains filtered or unexported fields
}

func NewExecContext

func NewExecContext(workDir string, writer func(string), env []string) ExecContext

func (ExecContext) GetStdout

func (self ExecContext) GetStdout(cmd ...string) (string, error)

func (ExecContext) NewCommand

func (self ExecContext) NewCommand(cmd ...string) *exec.Cmd

func (ExecContext) Run

func (self ExecContext) Run(cmd ...string) error

type UserInfo

type UserInfo struct {
	UserId  int
	GroupId int
}

func GetUserInfo

func GetUserInfo(userName string) (UserInfo, error)

Jump to

Keyboard shortcuts

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