Documentation
¶
Index ¶
- Variables
- func AddGookmeScript(content string, scriptscriptVariables *ScriptVariables) (string, error)
- func AssertFile(path string) error
- func AssertFolder(path string) error
- func DeleteScriptFile(gitFolderPath string, hookName configuration.HookType) error
- func GenerateScript(variables *ScriptVariables, template string) string
- func LoadScriptFileContent(gitFolderPath string, hookName configuration.HookType) (string, error)
- func ParseScriptVersion(content string) (string, error)
- func RemoveExistingGookmeScript(content string) string
- func ScriptFileExists(gitFolderPath string, hookName configuration.HookType) (bool, error)
- func WriteScriptFileContent(gitFolderPath string, hookName configuration.HookType, content string) error
- type ScriptVariables
Constants ¶
This section is empty.
Variables ¶
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)
AddGookmeScript adds the gookme script to the provided content
func AssertFile ¶
AssertFile checks if the file at the provided path exists, if not it creates it
func AssertFolder ¶
AssertFolder checks if the folder at the provided path exists, if not it creates it
func DeleteScriptFile ¶
func DeleteScriptFile(gitFolderPath string, hookName configuration.HookType) error
func GenerateScript ¶
func GenerateScript(variables *ScriptVariables, template string) string
GenerateScript generates a script from a template and the provided variables
func LoadScriptFileContent ¶
func LoadScriptFileContent(gitFolderPath string, hookName configuration.HookType) (string, error)
LoadScriptFileContent loads the content of a file located in the .git folder of the provided directory, and named after the provided hook name.
func ParseScriptVersion ¶
ParseScriptVersion Looks for a script in the provided content, and parse it to get the version it has been generated with
func RemoveExistingGookmeScript ¶
RemoveExistingGookmeScript removes 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
WriteScriptFileContent writes a script in the .git folder, with the provided content and named after the provided hook name.
Types ¶
type ScriptVariables ¶
type ScriptVariables struct {
HookType configuration.HookType
Version string
}