@@ -78,16 +78,14 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
7878 if err != nil {
7979 return fmt .Errorf ("list server commands: %w" , err )
8080 }
81- if commands := resp .Items ; commands == nil || len (* commands ) == 0 {
82- params .Printer .Info ("No commands found for server %s\n " , serverLabel )
83- return nil
84- }
85- commands := * resp .Items
81+
82+ commands := resp .GetItems ()
83+
8684 // Truncate output
8785 if model .Limit != nil && len (commands ) > int (* model .Limit ) {
8886 commands = commands [:* model .Limit ]
8987 }
90- return outputResult (params .Printer , model .OutputFormat , commands )
88+ return outputResult (params .Printer , model .OutputFormat , serverLabel , commands )
9189 },
9290 }
9391 configureFlags (cmd )
@@ -131,8 +129,12 @@ func buildRequest(ctx context.Context, model *inputModel, apiClient *runcommand.
131129 return req
132130}
133131
134- func outputResult (p * print.Printer , outputFormat string , commands []runcommand.Commands ) error {
132+ func outputResult (p * print.Printer , outputFormat , serverLabel string , commands []runcommand.Commands ) error {
135133 return p .OutputResult (outputFormat , commands , func () error {
134+ if len (commands ) == 0 {
135+ p .Outputf ("No commands found for server %s\n " , serverLabel )
136+ return nil
137+ }
136138 table := tables .NewTable ()
137139 table .SetHeader ("ID" , "TEMPLATE NAME" , "TEMPLATE TITLE" , "STATUS" , "STARTED_AT" , "FINISHED_AT" )
138140 for i := range commands {
0 commit comments