Skip to content

Commit

Permalink
Merge pull request #40 from Peefy/feat-run-git-entry
Browse files Browse the repository at this point in the history
feat: add git entry run
  • Loading branch information
Peefy authored Feb 18, 2024
2 parents 8f9bf95 + fb6eee3 commit ca83b59
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
kcl-lang.io/kcl-go v0.7.5
kcl-lang.io/kcl-openapi v0.5.5
kcl-lang.io/kcl-playground v0.5.1
kcl-lang.io/kpm v0.6.0
kcl-lang.io/kpm v0.7.1-0.20240218030334-f67db1b477d9
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1323,8 +1323,8 @@ kcl-lang.io/kcl-openapi v0.5.5 h1:6LSbiy53nczagm7Ohgdy1DVgQ+5ffMihsOUY7PGkbh0=
kcl-lang.io/kcl-openapi v0.5.5/go.mod h1:Ai9mFztCVKkRSFabczO/r5hCNdqaNtAc2ZIRxTeV0Mk=
kcl-lang.io/kcl-playground v0.5.1 h1:MKQQUHgt4+2QyU2NVwa73oksOaBJGDi4keGoggA0MiU=
kcl-lang.io/kcl-playground v0.5.1/go.mod h1:IFmnlw7m011ccX8OidMUfnnN2u/TWdtQGxyABRTbmow=
kcl-lang.io/kpm v0.6.0 h1:8gHMyV2l/EpZ/w27c3UyybXEBATvAzL81JdAFzdYqWc=
kcl-lang.io/kpm v0.6.0/go.mod h1:s9w+2itB6AcCNjdppZv2Tc9vGhKk/axtJ5XJYaWNR+0=
kcl-lang.io/kpm v0.7.1-0.20240218030334-f67db1b477d9 h1:+1k8IvGCYTJSzEYC6+jKsdJto6MAkhBCe49kDtX93ik=
kcl-lang.io/kpm v0.7.1-0.20240218030334-f67db1b477d9/go.mod h1:s9w+2itB6AcCNjdppZv2Tc9vGhKk/axtJ5XJYaWNR+0=
kcl-lang.io/lib v0.7.8 h1:kOYlrFqZkwzCG/CFs63cwbX3pPCNUci1Xvj7zqqnLno=
kcl-lang.io/lib v0.7.8/go.mod h1:ubsalGXxJaa5II/EsHmsI/tL2EluYHIcW+BwzQPt+uY=
oras.land/oras-go v1.2.3 h1:v8PJl+gEAntI1pJ/LCrDgsuk+1PKVavVEPsYIHFE5uY=
Expand Down
5 changes: 5 additions & 0 deletions pkg/options/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"kcl-lang.io/kcl-go/pkg/kcl"
"kcl-lang.io/kpm/pkg/api"
"kcl-lang.io/kpm/pkg/client"
"kcl-lang.io/kpm/pkg/git"
"kcl-lang.io/kpm/pkg/opt"
pkg "kcl-lang.io/kpm/pkg/package"
"kcl-lang.io/kpm/pkg/runner"
Expand Down Expand Up @@ -154,6 +155,10 @@ func (o *RunOptions) Run() error {
// kcl compiles the package from the kcl package tar.
opts.SetEntries([]string{})
result, err = cli.CompileTarPkg(entry.PackageSource(), opts)
} else if entry.IsGit() {
gitOpts := git.NewCloneOptions(entry.PackageSource(), "", o.Tag, "", "", nil)
// 'kpm run' compile the package from the git url
result, err = cli.CompileGitPkg(gitOpts, opts)
} else if entry.IsUrl() {
// kcl compiles the package from the OCI reference or url.
opts.SetEntries([]string{})
Expand Down

0 comments on commit ca83b59

Please sign in to comment.