utils

package
v0.0.0-...-6d44366 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListSeparator     = ","
	FilePathSeparator = string(filepath.Separator)
)

Variables

View Source
var (
	ErrApplicationNotFound = errors.New("application not found")
)

Functions

func Copy

func Copy(ctx context.Context, src, targetDir string) error

func ExecutePathApplication

func ExecutePathApplication(ctx context.Context, workingDir, cmd string, args ...string) (err error)

ExecutePathApplication executes a linux/windows command

func ExecuteQuietPathApplicationWithOutput

func ExecuteQuietPathApplicationWithOutput(ctx context.Context, workingDir, cmd string, args ...string) (lines []string, err error)

ExecuteQuietPathApplicationWithOutput executes a linux/windows command

func Exists

func Exists(filePath string) (fs.FileInfo, bool, error)

func ExistsDir

func ExistsDir(dirPath string) (bool, error)

func ExistsFile

func ExistsFile(filePath string) (bool, error)

func GitAddAll

func GitAddAll(ctx context.Context, repoDir string) error

func GitChangeRemoteUrl

func GitChangeRemoteUrl(ctx context.Context, repoDir, remoteName, targetUrl string) error

func GitCheckRemoteUrl

func GitCheckRemoteUrl(ctx context.Context, repoDir, targetUrl string) error

func GitCheckoutBranch

func GitCheckoutBranch(ctx context.Context, repoDir string, targetBranch string) error

func GitCheckoutNewBranch

func GitCheckoutNewBranch(ctx context.Context, repoDir string, targetBranch string) (err error)

func GitCloneBranch

func GitCloneBranch(ctx context.Context, repoDir, repoUrl, branchName string, depth ...int) error

func GitCommit

func GitCommit(ctx context.Context, repoDir string, message string) error

func GitCreateTag

func GitCreateTag(ctx context.Context, repoDir, tagName string) (err error)

func GitDeleteBranch

func GitDeleteBranch(ctx context.Context, repoDir string, targetBranch string) error

func GitDeleteRemoteBranch

func GitDeleteRemoteBranch(ctx context.Context, repoDir string, remoteName, targetBranch string) error

func GitExistsBranch

func GitExistsBranch(ctx context.Context, repoDir, branchName string) bool

func GitFetchPrune

func GitFetchPrune(ctx context.Context, repoDir string) error

func GitGetBranchName

func GitGetBranchName(ctx context.Context, repoDir string) (branch string, err error)

func GitGetDefaultBranch

func GitGetDefaultBranch(ctx context.Context, repoDir, remoteName string) (branchName string, err error)

func GitPull

func GitPull(ctx context.Context, repoDir string) error

func GitPullPrune

func GitPullPrune(ctx context.Context, repoDir string) error

GitPullPrune removes everything that does not exist in the remote repo

func GitPushTags

func GitPushTags(ctx context.Context, repoDir, remoteName string) (err error)

func GitPushUpstream

func GitPushUpstream(ctx context.Context, repoDir string, remoteName, targetBranch string) error

func GitRefreshIndex

func GitRefreshIndex(ctx context.Context, repoDir string) error

func GitRemoteUrl

func GitRemoteUrl(ctx context.Context, repoDir, remoteName string) (url string, err error)

func IsApplicationAvailable

func IsApplicationAvailable(ctx context.Context, name string) bool

func MustExistDir

func MustExistDir(dirPath string) error

func MustExistFile

func MustExistFile(filePath string) error

func StripUnsafe

func StripUnsafe(s string) string

StripUnsafe remove non-printable runes, e.g. control characters in a string that is meant for consumption by terminals that support control characters.

Types

type ErrExec

type ErrExec struct {
	ExitCode  int
	Output    string
	ErrOutput string
	Cmd       string
	Args      []string

	// Optional Error Code which might be provided by Windows
	SubExitCode int
}

func (ErrExec) Error

func (e ErrExec) Error() string

Jump to

Keyboard shortcuts

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