1package main
2
3import (
4 "log/slog"
5 "net/http"
6 _ "net/http/pprof"
7 "os"
8
9 "github.com/charmbracelet/crush/internal/cmd"
10 "github.com/charmbracelet/crush/internal/update"
11 _ "github.com/joho/godotenv/autoload"
12)
13
14func main() {
15 // Apply any pending update from previous run (Windows-specific).
16 if err := update.ApplyPendingUpdate(); err != nil {
17 slog.Warn("Failed to apply pending update", "error", err)
18 }
19
20 if os.Getenv("CRUSH_PROFILE") != "" {
21 go func() {
22 slog.Info("Serving pprof at localhost:6060")
23 if httpErr := http.ListenAndServe("localhost:6060", nil); httpErr != nil {
24 slog.Error("Failed to pprof listen", "error", httpErr)
25 }
26 }()
27 }
28
29 cmd.Execute()
30}