Documentation
¶
Overview ¶
Package hooks implements Atmos-managed Git hook shims: writing shim scripts into .git/hooks that delegate to `atmos git hooks run`, removing them, and executing the configured command for a named hook.
Index ¶
- Constants
- func Install(ctx context.Context, cfg *schema.GitConfig, names []string, force bool) error
- func NotConfiguredError(hookName string, hooks map[string]schema.GitHookEntry) error
- func Run(cfg *schema.GitConfig, hookName string, hookArgs []string) error
- func ShimContent(hookName string) string
- func SortedNames(m map[string]schema.GitHookEntry) []string
- func Uninstall(ctx context.Context, cfg *schema.GitConfig, names []string) error
- func ValidateShimName(hookName string) error
Constants ¶
const ( // ShimMarker is the unique string embedded in generated shim files. // Its presence identifies a file as Atmos-managed. ShimMarker = "# Generated by Atmos. Do not edit." )
Variables ¶
This section is empty.
Functions ¶
func Install ¶
Install writes shim scripts into .git/hooks for the named hooks (all configured hooks when names is empty). Existing non-Atmos files are only overwritten when force is set.
func NotConfiguredError ¶
func NotConfiguredError(hookName string, hooks map[string]schema.GitHookEntry) error
NotConfiguredError builds an ErrGitHookNotConfigured error with a hint listing configured hook names.
func Run ¶
Run executes the configured command for the named hook, forwarding the hook arguments and stdin.
func ShimContent ¶
ShimContent returns the generated shim content for a given hook name.
func SortedNames ¶
func SortedNames(m map[string]schema.GitHookEntry) []string
SortedNames returns the configured hook names in ascending order.
func Uninstall ¶
Uninstall removes Atmos-generated shims from .git/hooks for the named hooks (all configured hooks when names is empty). User-authored hooks are never deleted; a warning is emitted instead.
func ValidateShimName ¶
ValidateShimName rejects hook names that could escape .git/hooks.
Types ¶
This section is empty.