diff --git a/main.go b/main.go index 13af1ae45d1b0ef70c72dbdc2a684f9e7c46d3a3..70581b824b449c5557268e3d7ff4d61f547632d2 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ import ( "log/slog" "net/http" "os" + "runtime" _ "net/http/pprof" // profiling @@ -12,9 +13,14 @@ import ( "github.com/charmbracelet/crush/internal/cmd" "github.com/charmbracelet/crush/internal/log" + "github.com/charmbracelet/lipgloss/v2" ) func main() { + if runtime.GOOS == "windows" { + showWindowsWarning() + } + defer log.RecoverPanic("main", func() { slog.Error("Application terminated due to unhandled panic") }) @@ -30,3 +36,23 @@ func main() { cmd.Execute() } + +func showWindowsWarning() { + content := lipgloss.JoinVertical(lipgloss.Left, + lipgloss.NewStyle().Bold(true).Render("WARNING:")+" Crush is experimental on Windows!", + "", + "While we work on it, we recommend WSL2 for a better experience.", + "", + lipgloss.NewStyle().Italic(true).Render("Press Enter to continue..."), + ) + content = lipgloss.NewStyle(). + Border(lipgloss.RoundedBorder()). + Padding(1). + Render(content) + content += "\n" + + fmt.Print(content) + + var input string + fmt.Scanln(&input) +}