Skip to content

Commit

Permalink
feat: add WithLogger option for kpm v0.9.x
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy committed Aug 5, 2024
1 parent c3823c2 commit f699fdc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/client/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ package client
import (
"errors"
"fmt"
"io"
"os"
"path/filepath"

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

type RunOption func(*RunOptions) error

func WithLogger(l io.Writer) RunOption {
return func(ro *RunOptions) error {
if ro.Option == nil {
ro.Option = kcl.NewOption()
}
ro.Merge(kcl.WithLogger(l))
return nil
}
}

// WithWorkDir sets the work directory for running the kcl package.
func WithWorkDir(workDir string) RunOption {
return func(ro *RunOptions) error {
Expand Down

0 comments on commit f699fdc

Please sign in to comment.