Skip to content

Commit aaee174

Browse files
committed
adapted server command templates list command to align to expectations
1 parent 877acb7 commit aaee174

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

  • internal/cmd/server/command/template/list

internal/cmd/server/command/template/list/list.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,8 @@ func NewCmd(params *types.CmdParams) *cobra.Command {
6262
if err != nil {
6363
return fmt.Errorf("list server command templates: %w", err)
6464
}
65-
if templates := resp.Items; templates == nil || len(*templates) == 0 {
66-
params.Printer.Info("No commands templates found\n")
67-
return nil
68-
}
69-
templates := *resp.Items
65+
66+
templates := resp.GetItems()
7067

7168
// Truncate output
7269
if model.Limit != nil && len(templates) > int(*model.Limit) {
@@ -113,6 +110,10 @@ func buildRequest(ctx context.Context, _ *inputModel, apiClient *runcommand.APIC
113110

114111
func outputResult(p *print.Printer, outputFormat string, templates []runcommand.CommandTemplate) error {
115112
return p.OutputResult(outputFormat, templates, func() error {
113+
if len(templates) == 0 {
114+
p.Outputf("No commands templates found\n")
115+
return nil
116+
}
116117
table := tables.NewTable()
117118
table.SetHeader("NAME", "OS TYPE", "TITLE")
118119
for i := range templates {

0 commit comments

Comments
 (0)