Skip to content

Commit

Permalink
CLI: Hide "pending user invites" header if there aren't any (#4955)
Browse files Browse the repository at this point in the history
  • Loading branch information
begelundmuller authored May 25, 2024
1 parent d961ae5 commit 88ea878
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cli/cmd/user/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,16 @@ func listProjectInvites(cmd *cobra.Command, ch *cmdutil.Helper, org, project, pa
if err != nil {
return err
}

if len(invites.Invites) == 0 {
return nil
}

// If page token is empty, user is running the command first time and we print separator
if len(invites.Invites) > 0 && pageToken == "" {
if pageToken == "" {
cmd.Println()
}

ch.PrintfSuccess("Pending user invites\n")
ch.PrintInvites(invites.Invites)

Expand Down Expand Up @@ -173,10 +179,16 @@ func listOrgInvites(cmd *cobra.Command, ch *cmdutil.Helper, org, pageToken strin
if err != nil {
return err
}

if len(invites.Invites) == 0 {
return nil
}

// If page token is empty, user is running the command first time and we print separator
if len(invites.Invites) > 0 && pageToken == "" {
if pageToken == "" {
cmd.Println()
}

ch.PrintfSuccess("Pending user invites\n")
ch.PrintInvites(invites.Invites)

Expand Down

0 comments on commit 88ea878

Please sign in to comment.