hooksscripts

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorScriptAlreadyExists   = errors.New("script already exists")
	ErrorScriptVersionNotFound = errors.New("script version not found")
)

Functions

func AddGookmeScript

func AddGookmeScript(
	content string,
	scriptscriptVariables *ScriptVariables,
) (string, error)

func AssertFile

func AssertFile(path string) error

func AssertFolder

func AssertFolder(path string) error

func DeleteScriptFile

func DeleteScriptFile(gitFolderPath string, hookName configuration.HookType) error

func GenerateScript

func GenerateScript(variables *ScriptVariables, template string) string

func LoadScriptFileContent

func LoadScriptFileContent(gitFolderPath string, hookName configuration.HookType) (string, error)

func ParseScriptVersion

func ParseScriptVersion(content string) (string, error)

Look for a script in the provided content, and parse it to get the version it has been generated with

func RemoveExistingGookmeScript

func RemoveExistingGookmeScript(
	content string,
) string

Remove the gookme script from the provided content

func ScriptFileExists

func ScriptFileExists(gitFolderPath string, hookName configuration.HookType) (bool, error)

Check if git hook script for the provided hook type exists in the provided directory

func WriteScriptFileContent

func WriteScriptFileContent(gitFolderPath string, hookName configuration.HookType, content string) error

Types

type ScriptVariables

type ScriptVariables struct {
	HookType configuration.HookType
	Version  string
}

Jump to

Keyboard shortcuts

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