diff --git a/internal/cmd/session.go b/internal/cmd/session.go index 67f40a0cea7442efe5d36600dc27260ab66b2320..d960e06b017295c59d6a0c64e97b41f894d024c3 100644 --- a/internal/cmd/session.go +++ b/internal/cmd/session.go @@ -17,6 +17,7 @@ import ( "github.com/charmbracelet/colorprofile" "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/db" + "github.com/charmbracelet/crush/internal/event" "github.com/charmbracelet/crush/internal/message" "github.com/charmbracelet/crush/internal/session" "github.com/charmbracelet/crush/internal/ui/chat" @@ -126,6 +127,8 @@ func sessionSetup(cmd *cobra.Command) (context.Context, *sessionServices, func() } func runSessionList(cmd *cobra.Command, _ []string) error { + event.SessionListed(sessionListJSON) + ctx, svc, cleanup, err := sessionSetup(cmd) if err != nil { return err @@ -249,6 +252,8 @@ func resolveSessionID(ctx context.Context, svc session.Service, id string) (sess } func runSessionShow(cmd *cobra.Command, args []string) error { + event.SessionShown(sessionShowJSON) + ctx, svc, cleanup, err := sessionSetup(cmd) if err != nil { return err @@ -273,6 +278,8 @@ func runSessionShow(cmd *cobra.Command, args []string) error { } func runSessionDelete(cmd *cobra.Command, args []string) error { + event.SessionDeletedCommand(sessionDeleteJSON) + ctx, svc, cleanup, err := sessionSetup(cmd) if err != nil { return err @@ -305,6 +312,8 @@ func runSessionDelete(cmd *cobra.Command, args []string) error { } func runSessionRename(cmd *cobra.Command, args []string) error { + event.SessionRenamed(sessionRenameJSON) + ctx, svc, cleanup, err := sessionSetup(cmd) if err != nil { return err @@ -338,6 +347,8 @@ func runSessionRename(cmd *cobra.Command, args []string) error { } func runSessionLast(cmd *cobra.Command, _ []string) error { + event.SessionLastShown(sessionLastJSON) + ctx, svc, cleanup, err := sessionSetup(cmd) if err != nil { return err diff --git a/internal/event/all.go b/internal/event/all.go index 713421a0186fad28137ac68fabb8d594c305d2e9..abc10945c91c18dd4fe096ffb389c1fba676dea1 100644 --- a/internal/event/all.go +++ b/internal/event/all.go @@ -61,3 +61,23 @@ func TokensUsed(props ...any) { func StatsViewed() { send("stats viewed") } + +func SessionListed(json bool) { + send("session listed", "json", json, "cli", true) +} + +func SessionShown(json bool) { + send("session shown", "json", json, "cli", true) +} + +func SessionLastShown(json bool) { + send("session last shown", "json", json, "cli", true) +} + +func SessionDeletedCommand(json bool) { + send("session deleted", "json", json, "cli", true) +} + +func SessionRenamed(json bool) { + send("session renamed", "json", json, "cli", true) +}