Skip to content

Commit

Permalink
feat: impl override changed file
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <xpf6677@163.com>
  • Loading branch information
Peefy committed Oct 25, 2023
1 parent 8d0f691 commit af0dded
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
github.com/spf13/cobra v1.7.0
github.com/urfave/cli/v2 v2.25.0
kcl-lang.io/kcl-go v0.6.1
kcl-lang.io/kcl-go v0.6.2-0.20231025053208-f9ea93c99c1a
kcl-lang.io/kcl-openapi v0.5.1
kcl-lang.io/kpm v0.3.7
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,8 @@ k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrC
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
kcl-lang.io/kcl-artifact-go v0.6.0 h1:J/1FKzgGRqzFDkq0amBWxCdXXRMrtg5oT3IGtoo9sgU=
kcl-lang.io/kcl-artifact-go v0.6.0/go.mod h1:c07mqi9Hu2UjPW7lYfHhAAWOlZiB7lo7Vkr4jL5ov/M=
kcl-lang.io/kcl-go v0.6.1 h1:we/e3qvllsOoQj0YQht+yNxI+QFLWEmYn4FQ3zAvv9E=
kcl-lang.io/kcl-go v0.6.1/go.mod h1:1/xEscOhVGNabr9+rYC5peFDIjphbthYqk8UyHzaPRk=
kcl-lang.io/kcl-go v0.6.2-0.20231025053208-f9ea93c99c1a h1:ds5HFWjbt8+ns8rzvm3sH4Z9807sI96eSmISO2F8w9M=
kcl-lang.io/kcl-go v0.6.2-0.20231025053208-f9ea93c99c1a/go.mod h1:1/xEscOhVGNabr9+rYC5peFDIjphbthYqk8UyHzaPRk=
kcl-lang.io/kcl-openapi v0.5.1 h1:cnXANaoLQ0nUW4I8s147g8NcXYoXfb8xPnpNvAZI9pY=
kcl-lang.io/kcl-openapi v0.5.1/go.mod h1:Ai9mFztCVKkRSFabczO/r5hCNdqaNtAc2ZIRxTeV0Mk=
kcl-lang.io/kpm v0.3.7 h1:peemi1gndI4iNLJ2wmZwg2f8t98n8V/l5SC3hxKnAWE=
Expand Down
16 changes: 12 additions & 4 deletions pkg/options/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,16 @@ func (o *RunOptions) writer() (io.Writer, error) {
}
}

// / FilterByPath filters values using path selectors.
func FilterByPath(result *kcl.KCLResultList, pathSelectors []string) *kcl.KCLResultList {
if len(pathSelectors) == 0 || result == nil {
return result
}
return result
}

func (o *RunOptions) writeResult(result *kcl.KCLResultList) error {

if result == nil {
return nil
}
Expand Down Expand Up @@ -196,8 +205,9 @@ func CompileOptionFromCli(o *RunOptions) *opt.CompileOptions {

// --overrides, -O
if len(o.Overrides) != 0 {
for _, override := range o.Overrides {
opts.Merge(kcl.WithOverrides(override))
opts.Merge(kcl.WithOverrides(o.Overrides...))
if o.Debug {
opts.PrintOverrideAst = true
}
}

Expand All @@ -218,7 +228,5 @@ func CompileOptionFromCli(o *RunOptions) *opt.CompileOptions {
// --vendor
opts.SetVendor(o.Vendor)

// TODO: path_selector

return opts
}

0 comments on commit af0dded

Please sign in to comment.