hook

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Marker = "Code generated by Committed. DO NOT EDIT."
)

Variables

View Source
var (
	ErrAction    = errors.New("invalid hook action")
	ErrUnmanaged = errors.New("hook file unmanaged")
)
View Source
var ErrLocation = errors.New("no hook location found")
View Source
var GitHook = "hooks/prepare-commit-msg"
View Source
var PrepareGitMessage string

Functions

func Locate added in v0.10.0

func Locate(run Runner) (string, error)

Types

type Action

type Action int
const (
	ActionUnset Action = iota
	ActionInstall
	ActionUninstall
	ActionCommit
)

type Creator added in v0.10.0

type Creator func(name string, flag int, perm os.FileMode) (*os.File, error)

type Deleter added in v0.10.0

type Deleter func(string) error

type Hook

type Hook struct {
	Creator Creator
	Locater Locater
	Deleter Deleter
	Opener  Opener
	Runner  Runner
	Stater  Stater

	Location  string
	Directory string
	// contains filtered or unexported fields
}

func New

func New() Hook

func (*Hook) Do

func (h *Hook) Do(opts Options) error

func (*Hook) Install added in v0.10.0

func (h *Hook) Install() error

func (*Hook) Uninstall added in v0.10.0

func (h *Hook) Uninstall() error

type Locater added in v0.10.0

type Locater func(run Runner) (string, error)

type Opener added in v0.10.0

type Opener func(string) (*os.File, error)

type Options

type Options struct {
	Install   bool
	Uninstall bool
	Commit    bool
}

type Runner added in v0.10.0

type Runner func(io.Writer, string, []string) error

type Stater added in v0.10.0

type Stater func(string) (os.FileInfo, error)

Jump to

Keyboard shortcuts

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