Skip to content

Commit

Permalink
fix: add 'Deprecated'
Browse files Browse the repository at this point in the history
Signed-off-by: zongz <zongzhe1024@163.com>
  • Loading branch information
zong-zhe committed Dec 21, 2023
1 parent 6a71817 commit 8902a3d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pkg/api/kpm_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ func RunWithOpt(opts *opt.CompileOptions) (*kcl.KCLResultList, error) {
return kcl.RunWithOpts(*opts.Option)
}

// RunPkgWithOpts will compile the kcl package with the compile options.
func RunPkgWithOpts(opts ...opt.CompileOptions) (*kcl.KCLResultList, error) {
// RunWithOpts will compile the kcl package with the compile options.
func RunWithOpts(opts ...opt.CompileOptions) (*kcl.KCLResultList, error) {
mergedOpts := opt.MergeOptions(opts...)
return RunPkgWithOpt(&mergedOpts)
return runPkgWithOpt(&mergedOpts)
}

// getAbsInputPath will return the abs path of the file path described by '--input'.
Expand All @@ -109,6 +109,7 @@ func getAbsInputPath(pkgPath string, inputPath string) (string, error) {
}

// RunPkgWithOpt will compile the kcl package with the compile options.
// Deprecated: This method will not be maintained in the future. Use RunWithOpts instead.
func RunPkgWithOpt(opts *opt.CompileOptions) (*kcl.KCLResultList, error) {
kpmcli, err := client.NewKpmClient()
kpmcli.SetNoSumCheck(opts.NoSumCheck())
Expand All @@ -118,6 +119,15 @@ func RunPkgWithOpt(opts *opt.CompileOptions) (*kcl.KCLResultList, error) {
return run(kpmcli, opts)
}

func runPkgWithOpt(opts *opt.CompileOptions) (*kcl.KCLResultList, error) {
kpmcli, err := client.NewKpmClient()
kpmcli.SetNoSumCheck(opts.NoSumCheck())
if err != nil {
return nil, err
}
return run(kpmcli, opts)
}

// RunCurrentPkg will compile the current kcl package.
func RunCurrentPkg(opts *opt.CompileOptions) (*kcl.KCLResultList, error) {
pwd, err := os.Getwd()
Expand Down

0 comments on commit 8902a3d

Please sign in to comment.