on main help sign in
chore: send `interactive` attribute (for `crush run`) (#1635)
commit0d0ac7ce6776844e1bd2ad3e97bec67c14f3ad38 authorAndrey Nering <andreynering@users.noreply.github.com> dateMon 15 Dec 2025, 13:43 (1 year ago) parentc822651
2 files changed+13−1
internal/cmd/run.go+7 internal/event/event.go+6−1
internal/cmd/run.go+7
@@ -8,6 +8,7 @@ import (
88 "os/signal"
99 "strings"
1010
11+ "github.com/charmbracelet/crush/internal/event"
1112 "github.com/spf13/cobra"
1213)
1314
@@ -58,8 +59,14 @@ crush run --quiet "Generate a README for this project"
5859 return fmt.Errorf("no prompt provided")
5960 }
6061
62+ event.SetInteractive(true)
63+ event.AppInitialized()
64+
6165 return app.RunNonInteractive(ctx, os.Stdout, prompt, quiet)
6266 },
67+ PostRun: func(cmd *cobra.Command, args []string) {
68+ event.AppExited()
69+ },
6370}
6471
6572func init() {
internal/event/event.go+6−1
@@ -26,9 +26,14 @@ var (
2626 Set("TERM", os.Getenv("TERM")).
2727 Set("SHELL", filepath.Base(os.Getenv("SHELL"))).
2828 Set("Version", version.Version).
29− Set("GoVersion", runtime.Version())
29+ Set("GoVersion", runtime.Version()).
30+ Set("Interactive", false)
3031)
3132
33+func SetInteractive(interactive bool) {
34+ baseProps = baseProps.Set("interactive", interactive)
35+}
36+
3237func Init() {
3338 c, err := posthog.NewWithConfig(key, posthog.Config{
3439 Endpoint: endpoint,