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" )
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
Types ¶
type Command ¶
type Command struct {
Run string `mapstructure:"run" yaml:"run" json:"run" toml:"run"`
Skip interface{} `mapstructure:"skip" yaml:",omitempty" json:"skip,omitempty" toml:"skip,omitempty,inline"`
Only interface{} `mapstructure:"only" yaml:",omitempty" json:"only,omitempty" toml:"only,omitempty,inline"`
Tags []string `mapstructure:"tags" yaml:",omitempty" json:"tags,omitempty" toml:"tags,omitempty"`
Glob string `mapstructure:"glob" yaml:",omitempty" json:"glob,omitempty" toml:"glob,omitempty"`
Files string `mapstructure:"files" yaml:",omitempty" json:"files,omitempty" toml:"files,omitempty"`
Env map[string]string `mapstructure:"env" yaml:",omitempty" json:"env,omitempty" toml:"env,omitempty"`
Root string `mapstructure:"root" yaml:",omitempty" json:"root,omitempty" toml:"root,omitempty"`
Exclude string `mapstructure:"exclude" yaml:",omitempty" json:"exclude,omitempty" toml:"exclude,omitempty"`
FailText string `mapstructure:"fail_text" yaml:"fail_text,omitempty" json:"fail_text,omitempty" toml:"fail_text,omitempty"`
Interactive bool `mapstructure:"interactive" yaml:",omitempty" json:"interactive,omitempty" toml:"interactive,omitempty"`
UseStdin bool `mapstructure:"use_stdin" yaml:",omitempty" json:"use_stdin,omitempty" toml:"use_stdin,omitempty"`
StageFixed bool `mapstructure:"stage_fixed" yaml:"stage_fixed,omitempty" json:"stage_fixed,omitempty" toml:"stage_fixed,omitempty"`
}
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 []string `mapstructure:"skip_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"`
Remote *Remote `mapstructure:"remote,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 `mapstructure:"-" yaml:",omitempty" json:"commands,omitempty" toml:"commands,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 `mapstructure:"-" yaml:",omitempty" json:"scripts,omitempty" toml:"scripts,omitempty"`
Files string `mapstructure:"files" yaml:",omitempty" json:"files,omitempty" toml:"files,omitempty"`
Parallel bool `mapstructure:"parallel" yaml:",omitempty" json:"parallel,omitempty" toml:"parallel,omitempty"`
Piped bool `mapstructure:"piped" yaml:",omitempty" json:"piped,omitempty" toml:"piped,omitempty"`
Follow bool `mapstructure:"follow" yaml:",omitempty" json:"follow,omitempty" toml:"follow,omitempty"`
ExcludeTags []string `mapstructure:"exclude_tags" yaml:"exclude_tags,omitempty" json:"exclude_tags,omitempty" toml:"exclude_tags,omitempty"`
Skip interface{} `mapstructure:"skip" yaml:",omitempty" json:"skip,omitempty" toml:"skip,omitempty,inline"`
Only interface{} `mapstructure:"only" yaml:",omitempty" json:"only,omitempty" toml:"only,omitempty,inline"`
}
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 `mapstructure:"git_url" yaml:"git_url" json:"git_url,omitempty" toml:"git_url"`
Ref string `mapstructure:"ref,omitempty" yaml:",omitempty" json:"ref,omitempty" toml:"ref,omitempty"`
Config string `mapstructure:"config,omitempty" yaml:",omitempty" json:"config,omitempty" toml:"config,omitempty"`
}
func (*Remote) Configured ¶ added in v1.2.0
type Script ¶
type Script struct {
Runner string `mapstructure:"runner" yaml:"runner" json:"runner" toml:"runner"`
Skip interface{} `mapstructure:"skip" yaml:",omitempty" json:"skip,omitempty" toml:"skip,omitempty,inline"`
Only interface{} `mapstructure:"only" yaml:",omitempty" json:"only,omitempty" toml:"only,omitempty,inline"`
Tags []string `mapstructure:"tags" yaml:",omitempty" json:"tags,omitempty" toml:"tags,omitempty"`
Env map[string]string `mapstructure:"env" yaml:",omitempty" json:"env,omitempty" toml:"env,omitempty"`
FailText string `mapstructure:"fail_text" yaml:"fail_text,omitempty" json:"fail_text,omitempty" toml:"fail_text,omitempty"`
Interactive bool `mapstructure:"interactive" yaml:",omitempty" json:"interactive,omitempty" toml:"interactive,omitempty"`
UseStdin bool `mapstructure:"use_stdin" yaml:",omitempty" json:"use_stdin,omitempty" toml:"use_stdin,omitempty"`
StageFixed bool `mapstructure:"stage_fixed" yaml:"stage_fixed,omitempty" json:"stage_fixed,omitempty" toml:"stage_fixed,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.