Documentation
¶
Index ¶
Constants ¶
View Source
const ( SubFiles string = "{files}" SubAllFiles string = "{all_files}" SubStagedFiles string = "{staged_files}" PushFiles string = "{push_files}" )
View Source
const ( DefaultConfigName = "lefthook.yml" DefaultSourceDir = ".lefthook" DefaultSourceDirLocal = ".lefthook-local" DefaultColorsEnabled = true )
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-applypatch",
"applypatch-msg",
"post-applypatch",
"commit-msg",
"fsmonitor-watchman",
"p4-changelist",
"p4-post-changelist",
"p4-pre-submit",
"p4-prepare-changelist",
"pre-commit",
"post-commit",
"pre-receive",
"proc-receive",
"post-receive",
"post-merge",
"pre-rebase",
"rebase",
"update",
"post-update",
"post-rewrite",
"post-checkout",
"post-index-change",
"pre-auto-gc",
"pre-merge-commit",
"pre-push",
"prepare-commit-msg",
"push-to-checkout",
"reference-transaction",
"sendemail-validate",
}
AvailableHooks - list of hooks taken from https://git-scm.com/docs/githooks.
Functions ¶
func HookAvailable ¶
Types ¶
type Command ¶
type Command struct {
Run string `mapstructure:"run"`
Skip interface{} `mapstructure:"skip"`
Tags []string `mapstructure:"tags"`
Glob string `mapstructure:"glob"`
Files string `mapstructure:"files"`
Env map[string]string `mapstructure:"env"`
Root string `mapstructure:"root"`
Exclude string `mapstructure:"exclude"`
FailText string `mapstructure:"fail_text"`
Interactive bool `mapstructure:"interactive"`
}
type Config ¶
type Config struct {
Colors bool `mapstructure:"colors"`
Extends []string `mapstructure:"extends"`
Remote Remote `mapstructure:"remote"`
MinVersion string `mapstructure:"min_version"`
SkipOutput []string `mapstructure:"skip_output"`
SourceDir string `mapstructure:"source_dir"`
SourceDirLocal string `mapstructure:"source_dir_local"`
Hooks map[string]*Hook
}
type Hook ¶
type Hook struct {
// Should be unmarshalled with `mapstructure:"commands"`
// But replacing '{cmd}' is still an issue
// Unmarshaling it manually, so omit auto unmarshaling
Commands map[string]*Command `mapstructure:"?"`
// Should be unmarshalled with `mapstructure:"scripts"`
// But parsing keys with dots in it is still an issue: https://github.com/spf13/viper/issues/324
// Unmarshaling it manually, so omit auto unmarshaling
Scripts map[string]*Script `mapstructure:"?"`
Files string `mapstructure:"files"`
Parallel bool `mapstructure:"parallel"`
Piped bool `mapstructure:"piped"`
ExcludeTags []string `mapstructure:"exclude_tags"`
}
type Remote ¶ added in v1.2.0
type Remote struct {
GitURL string `mapstructure:"git_url"`
Ref string `mapstructure:"ref"`
Config string `mapstructure:"config"`
}
func (Remote) Configured ¶ added in v1.2.0
Click to show internal directories.
Click to hide internal directories.