Skip to content

Commit f699fdc

Browse files
committed
feat: add WithLogger option for kpm v0.9.x
Signed-off-by: peefy <xpf6677@163.com>
1 parent c3823c2 commit f699fdc

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pkg/client/run.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ package client
6565
import (
6666
"errors"
6767
"fmt"
68+
"io"
6869
"os"
6970
"path/filepath"
7071

@@ -88,6 +89,16 @@ type RunOptions struct {
8889

8990
type RunOption func(*RunOptions) error
9091

92+
func WithLogger(l io.Writer) RunOption {
93+
return func(ro *RunOptions) error {
94+
if ro.Option == nil {
95+
ro.Option = kcl.NewOption()
96+
}
97+
ro.Merge(kcl.WithLogger(l))
98+
return nil
99+
}
100+
}
101+
91102
// WithWorkDir sets the work directory for running the kcl package.
92103
func WithWorkDir(workDir string) RunOption {
93104
return func(ro *RunOptions) error {

0 commit comments

Comments
 (0)