Skip to content

Commit

Permalink
fix: LEFTHOOK_VERBOSE properly overrides --verbose flag
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperupcall committed Jul 14, 2023
1 parent d7b8cb7 commit d205c94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions internal/lefthook/lefthook.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package lefthook
import (
"bufio"
"fmt"
"os"
"path/filepath"
"regexp"

Expand Down Expand Up @@ -35,6 +36,10 @@ type Lefthook struct {

// New returns an instance of Lefthook.
func initialize(opts *Options) (*Lefthook, error) {
if os.Getenv(envVerbose) == "1" || os.Getenv(envVerbose) == "true" {
opts.Verbose = true
}

if opts.Verbose {
log.SetLevel(log.DebugLevel)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/lefthook/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (l *Lefthook) Run(hookName string, args RunArgs, gitArgs []string) error {
}

var verbose bool
if l.Verbose || os.Getenv(envVerbose) == "1" || os.Getenv(envVerbose) == "true" {
if l.Verbose {
log.SetLevel(log.DebugLevel)
verbose = true
}
Expand Down

0 comments on commit d205c94

Please sign in to comment.