Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CurrentBranchStub = func(output string, err error) CurrentBranchFunc { return func(_ string) (string, error) { if err != nil { return "", err } return output, nil } }
CurrentBranchStub creates a stub CurrentBranchFunc that returns the provided output or error.
var WorkDirStub = func(dir string, err error) WorkDirFunc { return func() (string, error) { return dir, err } }
WorkDirStub creates a stub WorkDirFunc that returns the provided directory or error.
Functions ¶
func NewGitCliWrapper ¶
func NewGitCliWrapper() *gitCliWrapper
NewGitCliWrapper creates a new git CLI wrapper using FUNC_GIT env var or "git" as default.
Types ¶
type CurrentBranchFunc ¶
CurrentBranchFunc is a function type that retrieves the current git branch for a given path.
var DefaultCurrentBranch CurrentBranchFunc = NewGitCliWrapper().CurrentBranch
DefaultCurrentBranch is the default implementation for getting the current git branch.
type FunctionLoader ¶
FunctionLoader loads a function from a filesystem path.
type FunctionLoaderSaver ¶
type FunctionLoaderSaver interface {
FunctionLoader
FunctionSaver
}
FunctionLoaderSaver combines loading and saving capabilities for functions.
var DefaultLoaderSaver FunctionLoaderSaver = standardLoaderSaver{}
DefaultLoaderSaver implements FunctionLoaderSaver composite interface
type FunctionSaver ¶
FunctionSaver persists a function to storage.
type MockLoaderSaver ¶
type MockLoaderSaver struct {
LoadFn func(path string) (fn.Function, error)
SaveFn func(f fn.Function) error
}
MockLoaderSaver provides configurable function loading and saving for testing purposes.
func NewMockLoaderSaver ¶
func NewMockLoaderSaver() *MockLoaderSaver
NewMockLoaderSaver creates a MockLoaderSaver with default no-op implementations.
type WorkDirFunc ¶
WorkDirFunc is a function type that retrieves the current working directory.
var DefaultWorkDir WorkDirFunc = os.Getwd
DefaultWorkDir is the default implementation for getting the current working directory.