Skip to content

Commit

Permalink
Merge pull request #96 from Peefy/feat-import-from-toml
Browse files Browse the repository at this point in the history
feat: import from toml on CLI
  • Loading branch information
Peefy authored Jun 12, 2024
2 parents a7be78c + fc96f58 commit abbffd9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cmd/kcl/commands/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Supported conversion modes:
# Generate KCL models from YAML
kcl import data.yaml
# Generate KCL models from TOML
kcl import data.toml
# Generate KCL models from JSON Schema
kcl import -m jsonschema schema.json
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/onsi/ginkgo/v2 v2.19.0
github.com/onsi/gomega v1.33.1
github.com/spf13/cobra v1.8.0
kcl-lang.io/kcl-go v0.9.0-rc.1
kcl-lang.io/kcl-go v0.9.0-rc.1.0.20240612024548-8d927747bd42
kcl-lang.io/kcl-openapi v0.6.1
kcl-lang.io/kcl-playground v0.5.1
kcl-lang.io/kpm v0.9.0-rc.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1683,8 +1683,8 @@ k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk=
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
kcl-lang.io/kcl-go v0.9.0-rc.1 h1:AyS6PDmn1L3BgNVW/r05L+d/5KmuKtEwgJr7n8YQ7p8=
kcl-lang.io/kcl-go v0.9.0-rc.1/go.mod h1:P3tVAITO71STsZ1M62MDj8jE/9nx3XuNFXy6Kr3UTRY=
kcl-lang.io/kcl-go v0.9.0-rc.1.0.20240612024548-8d927747bd42 h1:by7mlQjBOvUl560CcaGd+Ecjqm3tErFfAcJLowtSj9U=
kcl-lang.io/kcl-go v0.9.0-rc.1.0.20240612024548-8d927747bd42/go.mod h1:P3tVAITO71STsZ1M62MDj8jE/9nx3XuNFXy6Kr3UTRY=
kcl-lang.io/kcl-openapi v0.6.1 h1:iPH0EvPgDGZS5Lk00/Su5Av6AQP5IBG8f7gAUyevkHE=
kcl-lang.io/kcl-openapi v0.6.1/go.mod h1:Ai9mFztCVKkRSFabczO/r5hCNdqaNtAc2ZIRxTeV0Mk=
kcl-lang.io/kcl-playground v0.5.1 h1:MKQQUHgt4+2QyU2NVwa73oksOaBJGDi4keGoggA0MiU=
Expand Down
2 changes: 2 additions & 0 deletions pkg/options/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ func (o *ImportOptions) Run() error {
opts.Mode = gen.ModeJson
case Yaml:
opts.Mode = gen.ModeYaml
case Toml:
opts.Mode = gen.ModeToml
case GoStruct:
opts.Mode = gen.ModeGoStruct
case JsonSchema:
Expand Down

0 comments on commit abbffd9

Please sign in to comment.