utils

package
v0.0.0-...-f3a7fab Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureBaseDir

func EnsureBaseDir(fpath string) error

EnsureBaseDir make sure the parent directory of fpath exists

func FilterExecOutput

func FilterExecOutput(cmd *exec.Cmd, timeout time.Duration, filter func(line string) bool) ([]string, error)

func OpenURL

func OpenURL(url string) (io.ReadCloser, error)

OpenURL open the url for reading It will reaturn error if open failed or the StatusCode is bigger than 299 NOTE: the return reader need be closed

func RemoteCatLine

func RemoteCatLine(url string) (string, error)

func RunCommand

func RunCommand(prog string, args ...string) (string, error)

func TeeToFile

func TeeToFile(in io.Reader, fpath string, handler func(io.Reader) error) error

TeeToFile invoke the handler with a new io.Reader which created by TeeReader in and the fpath's writer

func UnsetEnv

func UnsetEnv(envName string) (err error)

UnsetEnv 清除指定名称 envName 的环境变量

func ValidURL

func ValidURL(url string) bool

func WriteData

func WriteData(fpath string, data interface{}) error

WriteData 把数据 data 序列化为 JSON 格式写入 fpath 路径的文件。

Types

type OSTree

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

func NewOSTree

func NewOSTree(repo string, remote string) (*OSTree, error)

func (*OSTree) Cat

func (tree *OSTree) Cat(branch string, fpath string) (string, error)

func (*OSTree) Checkout

func (tree *OSTree) Checkout(branch string, target string, force bool) error

func (*OSTree) HasBranch

func (tree *OSTree) HasBranch(branch string) bool

func (*OSTree) List

func (tree *OSTree) List(branch string, root string) (string, error)

func (*OSTree) NeedCheckout

func (tree *OSTree) NeedCheckout(branch string, target string) bool

NeedCheckout check whether the target content by target/.checkout_commit file

func (*OSTree) Pull

func (tree *OSTree) Pull(branch string) error

func (*OSTree) RemoteURL

func (tree *OSTree) RemoteURL() string

Directories

Path Synopsis
fixme

Jump to

Keyboard shortcuts

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