on main help sign in
fix(fsext): only log warnings if log is initialized
edd4996Ayman Bagabas
internal/fsext/fileutil.go+7−2
@@ -12,6 +12,7 @@ import (
12
12
13 "github.com/bmatcuk/doublestar/v4"
13 "github.com/bmatcuk/doublestar/v4"
14 "github.com/charlievieth/fastwalk"
14 "github.com/charlievieth/fastwalk"
15+ "github.com/charmbracelet/crush/internal/log"
15
16
16 ignore "github.com/sabhiram/go-gitignore"
17 ignore "github.com/sabhiram/go-gitignore"
17)
18)
@@ -25,11 +26,15 @@ func init() {
25 var err error
26 var err error
26 rgPath, err = exec.LookPath("rg")
27 rgPath, err = exec.LookPath("rg")
27 if err != nil {
28 if err != nil {
29+ if log.IsInitialized() {
28− slog.Warn("Ripgrep (rg) not found in $PATH. Some features might be limited or slower.")
30+ slog.Warn("Ripgrep (rg) not found in $PATH. Some features might be limited or slower.")
31+ }
29 }
32 }
30 fzfPath, err = exec.LookPath("fzf")
33 fzfPath, err = exec.LookPath("fzf")
31 if err != nil {
34 if err != nil {
35+ if log.IsInitialized() {
32− slog.Warn("FZF not found in $PATH. Some features might be limited or slower.")
36+ slog.Warn("FZF not found in $PATH. Some features might be limited or slower.")
37+ }
33 }
38 }
34}
39}
35
40