@@ -66,23 +66,21 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
6666 if err != nil {
6767 return fmt .Errorf ("get Observability instances: %w" , err )
6868 }
69- instances := * resp .Instances
70- if len (instances ) == 0 {
71- projectLabel , err := projectname .GetProjectName (ctx , params .Printer , params .CliVersion , cmd )
72- if err != nil {
73- params .Printer .Debug (print .ErrorLevel , "get project name: %v" , err )
74- projectLabel = model .ProjectId
75- }
76- params .Printer .Info ("No instances found for project %q\n " , projectLabel )
77- return nil
69+
70+ instances := resp .GetInstances ()
71+
72+ projectLabel , err := projectname .GetProjectName (ctx , params .Printer , params .CliVersion , cmd )
73+ if err != nil {
74+ params .Printer .Debug (print .ErrorLevel , "get project name: %v" , err )
75+ projectLabel = model .ProjectId
7876 }
7977
8078 // Truncate output
8179 if model .Limit != nil && len (instances ) > int (* model .Limit ) {
8280 instances = instances [:* model .Limit ]
8381 }
8482
85- return outputResult (params .Printer , model .OutputFormat , instances )
83+ return outputResult (params .Printer , model .OutputFormat , projectLabel , instances )
8684 },
8785 }
8886
@@ -122,8 +120,12 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *observabili
122120 return req
123121}
124122
125- func outputResult (p * print.Printer , outputFormat string , instances []observability.ProjectInstanceFull ) error {
123+ func outputResult (p * print.Printer , outputFormat , projectLabel string , instances []observability.ProjectInstanceFull ) error {
126124 return p .OutputResult (outputFormat , instances , func () error {
125+ if len (instances ) == 0 {
126+ p .Outputf ("No instances found for project %q\n " , projectLabel )
127+ return nil
128+ }
127129 table := tables .NewTable ()
128130 table .SetHeader ("ID" , "NAME" , "PLAN" , "STATUS" )
129131 for i := range instances {
0 commit comments