Skip to content

Commit f7a59e9

Browse files
committed
fix(cmd): align builder with formatter interface (PRINFRA-125)
1 parent 3110aa3 commit f7a59e9

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

cmd/heygen/builder.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ func buildCobraCommand(spec *command.Spec, ctx *cmdContext) *cobra.Command {
5858
var truncErr *client.ErrPaginationTruncated
5959
if errors.As(err, &truncErr) {
6060
fmt.Fprintf(cmd.ErrOrStderr(), "Warning: %s\n", truncErr.Error())
61-
if fmtErr := ctx.formatter.Data(truncErr.Data); fmtErr != nil {
61+
if fmtErr := ctx.formatter.Data(truncErr.Data, "", nil); fmtErr != nil {
6262
return fmtErr
6363
}
6464
return clierrors.New(truncErr.Error())
6565
}
6666
return err
6767
}
6868

69-
return ctx.formatter.Data(result)
69+
return ctx.formatter.Data(result, "", nil)
7070
}
7171
}
7272

cmd/heygen/testutil_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"io"
77
"net/http"
88
"net/http/httptest"
9+
"os"
910
"testing"
1011

1112
clierrors "github.com/heygen-com/heygen-cli/internal/errors"
@@ -70,10 +71,11 @@ func runCommandWithInput(t *testing.T, serverURL, apiKey string, stdin io.Reader
7071
formatter := formatterForArgs(args, &stdout, &stderr)
7172

7273
// Set env vars for this test
73-
if apiKey != "" {
74-
t.Setenv("HEYGEN_API_KEY", apiKey)
75-
}
74+
t.Setenv("HEYGEN_API_KEY", apiKey)
7675
t.Setenv("HEYGEN_API_BASE", serverURL)
76+
if _, ok := os.LookupEnv("HEYGEN_CONFIG_DIR"); !ok {
77+
t.Setenv("HEYGEN_CONFIG_DIR", t.TempDir())
78+
}
7779

7880
cmd := newRootCmd("test", formatter)
7981
cmd.SetOut(&stdout)

0 commit comments

Comments
 (0)