Skip to content

Commit

Permalink
fix: git repo running
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <xpf6677@163.com>
  • Loading branch information
Peefy committed Feb 22, 2024
1 parent b7d5d2e commit e9e2803
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cmd/kcl/commands/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ For example, 'kcl run path/to/kcl.k' will run the file named path/to/kcl.k
# Run OCI packages
kcl run oci://ghcr.io/kcl-lang/hello-world
# Run remote Git repo
kcl run https://github.com/kcl-lang/flask-demo-kcl-manifests
# Run the current package
kcl run`
)
Expand Down
7 changes: 4 additions & 3 deletions pkg/options/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,16 @@ func (o *RunOptions) Run() error {
}
result, err = cli.CompileWithOpts(opts)
} else if entry.IsTar() {
// kcl compiles the package from the kcl package tar.
// compiles the package from the kcl package tar.
opts.SetEntries([]string{})
result, err = cli.CompileTarPkg(entry.PackageSource(), opts)
} else if entry.IsGit() {
opts.SetEntries([]string{})
gitOpts := git.NewCloneOptions(entry.PackageSource(), "", o.Tag, "", "", nil)
// 'kpm run' compile the package from the git url
// compiles 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.
// compiles the package from the OCI reference or url.
opts.SetEntries([]string{})
result, err = cli.CompileOciPkg(entry.PackageSource(), o.Tag, opts)
} else {
Expand Down

0 comments on commit e9e2803

Please sign in to comment.