Skip to content

Commit

Permalink
CLOUDP-270626 Fix executing "output" at <.Results>
Browse files Browse the repository at this point in the history
  • Loading branch information
fmenezes committed Oct 9, 2024
1 parent 539fc2c commit 8500cf8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/cli/output_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"io"
"os"
"reflect"
"strings"

"github.com/PaesslerAG/jsonpath"
Expand Down Expand Up @@ -125,6 +126,10 @@ func (opts *OutputOpts) Print(o any) error {
}

if t != "" {
k := reflect.TypeOf(o).Kind()
if (k == reflect.Slice || k == reflect.Ptr || k == reflect.Map || k == reflect.UnsafePointer) && reflect.ValueOf(o).IsNil() {
o = map[string]any{}
}
return templatewriter.Print(opts.ConfigWriter(), t, o)
}
_, err = fmt.Fprintln(opts.ConfigWriter(), o)
Expand Down

0 comments on commit 8500cf8

Please sign in to comment.