fix(fsext): only log warnings if log is initialized

Ayman Bagabas created

Change summary

internal/fsext/fileutil.go | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Detailed changes

internal/fsext/fileutil.go 🔗

@@ -12,6 +12,7 @@ import (
 
 	"github.com/bmatcuk/doublestar/v4"
 	"github.com/charlievieth/fastwalk"
+	"github.com/charmbracelet/crush/internal/log"
 
 	ignore "github.com/sabhiram/go-gitignore"
 )
@@ -25,11 +26,15 @@ func init() {
 	var err error
 	rgPath, err = exec.LookPath("rg")
 	if err != nil {
-		slog.Warn("Ripgrep (rg) not found in $PATH. Some features might be limited or slower.")
+		if log.IsInitialized() {
+			slog.Warn("Ripgrep (rg) not found in $PATH. Some features might be limited or slower.")
+		}
 	}
 	fzfPath, err = exec.LookPath("fzf")
 	if err != nil {
-		slog.Warn("FZF not found in $PATH. Some features might be limited or slower.")
+		if log.IsInitialized() {
+			slog.Warn("FZF not found in $PATH. Some features might be limited or slower.")
+		}
 	}
 }