Skip to content

Commit 04b6e5f

Browse files
committed
Usage: better_cat <file>
1 parent 14e5c64 commit 04b6e5f

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

cmd/auth/login.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ var loginCmd = &cobra.Command{
3232

3333
ctx := cmd.Context()
3434
api := keys.GetAPIInstance(ctx)
35+
telemetryClient := keys.GetTelemetryInstance(ctx)
36+
37+
// Track login command
38+
ctx, done := telemetryClient.TrackCommand(ctx, "auth.login", args)
39+
defer done()
3540

3641
fmt.Println("Please visit the following URL to login:")
3742
authenticationURL := api.BuildAuthenticationUrl(

cmd/root.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ var rootCmd = &cobra.Command{
8989
ctx := cmd.Context()
9090
api := keys.GetAPIInstance(ctx)
9191
analytics := keys.GetAnalyticsInstance(ctx)
92+
telemetryClient := keys.GetTelemetryInstance(ctx)
93+
94+
// Track command execution
95+
ctx, done := telemetryClient.TrackCommand(ctx, "splash", args)
96+
defer done()
9297

9398
photoOfTheDayID := viper.GetString("photo-of-the-day.id")
9499

@@ -364,7 +369,11 @@ func init() {
364369
}
365370

366371
func Execute(ctx context.Context) {
372+
telemetryClient := keys.GetTelemetryInstance(ctx)
373+
367374
if err := rootCmd.ExecuteContext(ctx); err != nil {
375+
// Track command errors
376+
telemetryClient.TrackError(ctx, err, "unknown")
368377
os.Exit(1)
369378
}
370379
}

0 commit comments

Comments
 (0)