Documentation ¶
Index ¶
Constants ¶
View Source
const ( SubFiles string = "{files}" SubAllFiles string = "{all_files}" SubStagedFiles string = "{staged_files}" SubPushFiles string = "{push_files}" )
View Source
const ( DefaultConfigName = "lefthook.yml" DefaultSourceDir = ".lefthook" DefaultSourceDirLocal = ".lefthook-local" )
View Source
const CMD = "{cmd}"
View Source
const ChecksumFileName = "lefthook.checksum"
ChecksumFileName - the file, which is used just to store the current config checksum version.
View Source
const GhostHookName = "prepare-commit-msg"
GhostHookName - the hook which logs are not shown and which is used for synchronizing hooks.
Variables ¶
View Source
var AvailableHooks = [...]string{
"pre-commit",
"pre-push",
"commit-msg",
"applypatch-msg",
"fsmonitor-watchman",
"p4-changelist",
"p4-post-changelist",
"p4-pre-submit",
"p4-prepare-changelist",
"post-applypatch",
"post-checkout",
"post-commit",
"post-index-change",
"post-merge",
"post-receive",
"post-rewrite",
"post-update",
"pre-applypatch",
"pre-auto-gc",
"pre-merge-commit",
"pre-rebase",
"pre-receive",
"prepare-commit-msg",
"proc-receive",
"push-to-checkout",
"rebase",
"reference-transaction",
"sendemail-validate",
"update",
}
AvailableHooks - list of hooks taken from https://git-scm.com/docs/githooks.
Functions ¶
func HookAvailable ¶
func HookUsesPushFiles ¶ added in v1.3.6
func HookUsesStagedFiles ¶ added in v1.3.0
func NewSkipChecker ¶ added in v1.6.6
func NewSkipChecker(executor Executor) *skipChecker
Types ¶
type Command ¶
type Command struct { Run string `json:"run" mapstructure:"run" toml:"run" yaml:"run"` Files string `json:"files,omitempty" mapstructure:"files" toml:"files,omitempty" yaml:",omitempty"` Skip interface{} `json:"skip,omitempty" mapstructure:"skip" toml:"skip,omitempty,inline" yaml:",omitempty"` Only interface{} `json:"only,omitempty" mapstructure:"only" toml:"only,omitempty,inline" yaml:",omitempty"` Tags []string `json:"tags,omitempty" mapstructure:"tags" toml:"tags,omitempty" yaml:",omitempty"` Env map[string]string `json:"env,omitempty" mapstructure:"env" toml:"env,omitempty" yaml:",omitempty"` FileTypes []string `json:"file_types,omitempty" mapstructure:"file_types" toml:"file_types,omitempty" yaml:"file_types,omitempty"` Glob string `json:"glob,omitempty" mapstructure:"glob" toml:"glob,omitempty" yaml:",omitempty"` Root string `json:"root,omitempty" mapstructure:"root" toml:"root,omitempty" yaml:",omitempty"` Exclude string `json:"exclude,omitempty" mapstructure:"exclude" toml:"exclude,omitempty" yaml:",omitempty"` Priority int `json:"priority,omitempty" mapstructure:"priority" toml:"priority,omitempty" yaml:",omitempty"` FailText string `json:"fail_text,omitempty" mapstructure:"fail_text" toml:"fail_text,omitempty" yaml:"fail_text,omitempty"` Interactive bool `json:"interactive,omitempty" mapstructure:"interactive" toml:"interactive,omitempty" yaml:",omitempty"` UseStdin bool `json:"use_stdin,omitempty" mapstructure:"use_stdin" toml:"use_stdin,omitempty" yaml:",omitempty"` StageFixed bool `json:"stage_fixed,omitempty" mapstructure:"stage_fixed" toml:"stage_fixed,omitempty" yaml:"stage_fixed,omitempty"` }
func (Command) ExecutionPriority ¶ added in v1.6.8
type Config ¶
type Config struct { MinVersion string `mapstructure:"min_version,omitempty"` SourceDir string `mapstructure:"source_dir"` SourceDirLocal string `mapstructure:"source_dir_local"` Rc string `mapstructure:"rc,omitempty"` SkipOutput interface{} `mapstructure:"skip_output,omitempty"` Output interface{} `mapstructure:"output,omitempty"` Extends []string `mapstructure:"extends,omitempty"` NoTTY bool `mapstructure:"no_tty,omitempty"` AssertLefthookInstalled bool `mapstructure:"assert_lefthook_installed,omitempty"` Colors interface{} `mapstructure:"colors,omitempty"` // Deprecated: use Remotes Remote *Remote `mapstructure:"remote,omitempty"` Remotes []*Remote `mapstructure:"remotes,omitempty"` Hooks map[string]*Hook `mapstructure:"-"` }
type Hook ¶
type Hook struct { // Should be unmarshalled with `mapstructure:"commands"` // But replacing '{cmd}' is still an issue // Unmarshalling it manually, so omit auto unmarshalling Commands map[string]*Command `json:"commands,omitempty" mapstructure:"-" toml:"commands,omitempty" yaml:",omitempty"` // Should be unmarshalled with `mapstructure:"scripts"` // But parsing keys with dots in it is still an issue: https://github.com/spf13/viper/issues/324 // Unmarshalling it manually, so omit auto unmarshalling Scripts map[string]*Script `json:"scripts,omitempty" mapstructure:"-" toml:"scripts,omitempty" yaml:",omitempty"` Files string `json:"files,omitempty" mapstructure:"files" toml:"files,omitempty" yaml:",omitempty"` Parallel bool `json:"parallel,omitempty" mapstructure:"parallel" toml:"parallel,omitempty" yaml:",omitempty"` Piped bool `json:"piped,omitempty" mapstructure:"piped" toml:"piped,omitempty" yaml:",omitempty"` Follow bool `json:"follow,omitempty" mapstructure:"follow" toml:"follow,omitempty" yaml:",omitempty"` ExcludeTags []string `json:"exclude_tags,omitempty" mapstructure:"exclude_tags" toml:"exclude_tags,omitempty" yaml:"exclude_tags,omitempty"` Skip interface{} `json:"skip,omitempty" mapstructure:"skip" toml:"skip,omitempty,inline" yaml:",omitempty"` Only interface{} `json:"only,omitempty" mapstructure:"only" toml:"only,omitempty,inline" yaml:",omitempty"` }
type NotFoundError ¶ added in v1.3.7
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError wraps viper.ConfigFileNotFoundError for lefthook.
func (NotFoundError) Error ¶ added in v1.3.7
func (err NotFoundError) Error() string
Error returns message of viper.ConfigFileNotFoundError.
type Remote ¶ added in v1.2.0
type Remote struct { GitURL string `json:"git_url,omitempty" mapstructure:"git_url" toml:"git_url" yaml:"git_url"` Ref string `json:"ref,omitempty" mapstructure:"ref,omitempty" toml:"ref,omitempty" yaml:",omitempty"` // Deprecated Config string `json:"config,omitempty" mapstructure:"config,omitempty" toml:"config,omitempty" yaml:",omitempty"` Configs []string `json:"configs,omitempty" mapstructure:"configs,omitempty" toml:"configs,omitempty" yaml:",omitempty"` }
func (*Remote) Configured ¶ added in v1.2.0
type Script ¶
type Script struct { Runner string `json:"runner" mapstructure:"runner" toml:"runner" yaml:"runner"` Skip interface{} `json:"skip,omitempty" mapstructure:"skip" toml:"skip,omitempty,inline" yaml:",omitempty"` Only interface{} `json:"only,omitempty" mapstructure:"only" toml:"only,omitempty,inline" yaml:",omitempty"` Tags []string `json:"tags,omitempty" mapstructure:"tags" toml:"tags,omitempty" yaml:",omitempty"` Env map[string]string `json:"env,omitempty" mapstructure:"env" toml:"env,omitempty" yaml:",omitempty"` Priority int `json:"priority,omitempty" mapstructure:"priority" toml:"priority,omitempty" yaml:",omitempty"` FailText string `json:"fail_text,omitempty" mapstructure:"fail_text" toml:"fail_text,omitempty" yaml:"fail_text,omitempty"` Interactive bool `json:"interactive,omitempty" mapstructure:"interactive" toml:"interactive,omitempty" yaml:",omitempty"` UseStdin bool `json:"use_stdin,omitempty" mapstructure:"use_stdin" toml:"use_stdin,omitempty" yaml:",omitempty"` StageFixed bool `json:"stage_fixed,omitempty" mapstructure:"stage_fixed" toml:"stage_fixed,omitempty" yaml:"stage_fixed,omitempty"` }
func (Script) ExecutionPriority ¶ added in v1.6.8
Click to show internal directories.
Click to hide internal directories.