Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions internal/cmd/project/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
if err != nil {
return err
}
if len(projects) == 0 {
params.Printer.Info("No projects found matching the criteria\n")
return nil
}

return outputResult(params.Printer, model.OutputFormat, projects)
},
Expand Down Expand Up @@ -192,7 +188,7 @@ func fetchProjects(ctx context.Context, model *inputModel, apiClient resourceMan
if err != nil {
return nil, fmt.Errorf("get projects: %w", err)
}
respProjects := *resp.Items
respProjects := resp.GetItems()
if len(respProjects) == 0 {
break
}
Expand All @@ -214,6 +210,10 @@ func fetchProjects(ctx context.Context, model *inputModel, apiClient resourceMan

func outputResult(p *print.Printer, outputFormat string, projects []resourcemanager.Project) error {
return p.OutputResult(outputFormat, projects, func() error {
if len(projects) == 0 {
p.Outputf("No projects found matching the criteria\n")
return nil
}
table := tables.NewTable()
table.SetHeader("ID", "NAME", "STATE", "PARENT ID")
for i := range projects {
Expand Down
Loading