Skip to content

Commit

Permalink
fix: use ENV values only if --colors option not set
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexox committed Aug 30, 2024
1 parent f756263 commit 0d0050d
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions internal/lefthook/lefthook.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,19 @@ func initialize(opts *Options) (*Lefthook, error) {
log.SetLevel(log.DebugLevel)
}

if isEnvEnabled(envForceColor) {
opts.Colors = "on"
}
if opts.Colors == "auto" {
if isEnvEnabled(envForceColor) {
opts.Colors = "on"
}

if isEnvEnabled(envNoColor) {
opts.Colors = "off"
}
if isEnvEnabled(envNoColor) {
opts.Colors = "off"
}

// DEPRECATED: Will be removed with a --no-colors option
if opts.NoColors && opts.Colors == "auto" {
opts.Colors = "off"
// DEPRECATED: Will be removed with a --no-colors option
if opts.NoColors {
opts.Colors = "off"
}
}

log.SetColors(opts.Colors)
Expand Down

0 comments on commit 0d0050d

Please sign in to comment.