@@ -269,8 +269,8 @@ var RootCmd = &cobra.Command{
269
269
Args : cobra .NoArgs ,
270
270
Short : "Defang CLI manages services on the Defang cluster" ,
271
271
PersistentPreRunE : func (cmd * cobra.Command , args []string ) (err error ) {
272
- // Don't track the completion commands
273
- if cmd . Name () == "__complete" || ( cmd . Parent () != nil && cmd . Parent (). Name () == "completion" ) {
272
+ // Don't track/connect the completion commands
273
+ if IsCompletionCommand ( cmd ) {
274
274
return nil
275
275
}
276
276
@@ -338,6 +338,7 @@ var RootCmd = &cobra.Command{
338
338
if connect .CodeOf (err ) == connect .CodeUnauthenticated {
339
339
term .Warn (" !" , prettyError (err ))
340
340
341
+ defer trackCmd (nil , "Login" , P {"reason" , err })
341
342
if err = cli .InteractiveLogin (cmd .Context (), client , gitHubClientId , cluster ); err != nil {
342
343
return err
343
344
}
@@ -352,6 +353,8 @@ var RootCmd = &cobra.Command{
352
353
// Check if the user has agreed to the terms of service and show a prompt if needed
353
354
if connect .CodeOf (err ) == connect .CodeFailedPrecondition {
354
355
term .Warn (" !" , prettyError (err ))
356
+
357
+ defer trackCmd (nil , "Terms" , P {"reason" , err })
355
358
if err = cli .InteractiveAgreeToS (cmd .Context (), client ); err != nil {
356
359
return err
357
360
}
0 commit comments