From e9e2803bfaf82b484e627b4398abf2a19ee6242d Mon Sep 17 00:00:00 2001 From: peefy Date: Thu, 22 Feb 2024 16:07:50 +0800 Subject: [PATCH] fix: git repo running Signed-off-by: peefy --- cmd/kcl/commands/run.go | 3 +++ pkg/options/run.go | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/kcl/commands/run.go b/cmd/kcl/commands/run.go index a8454dd..17e571d 100644 --- a/cmd/kcl/commands/run.go +++ b/cmd/kcl/commands/run.go @@ -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` ) diff --git a/pkg/options/run.go b/pkg/options/run.go index e41b0f1..b90a198 100644 --- a/pkg/options/run.go +++ b/pkg/options/run.go @@ -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 {