Skip to content

Commit

Permalink
fix: rename in kpm add
Browse files Browse the repository at this point in the history
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
  • Loading branch information
officialasishkumar committed May 19, 2024
1 parent 5a3394c commit b86884d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,12 @@ func (c *KpmClient) AddDepWithOpts(kclPkg *pkg.KclPkg, opt *opt.AddOptions) (*pk
}

// 3. update the kcl.mod and kcl.mod.lock.
tempDeps := kclPkg.ModFile.Dependencies.Deps[d.Name]
tempDeps.Name = opt.NewPkgName
kclPkg.ModFile.Dependencies.Deps[d.Name] = tempDeps

if opt.NewPkgName != "" {
tempDeps := kclPkg.ModFile.Dependencies.Deps[d.Name]
tempDeps.Name = opt.NewPkgName
kclPkg.ModFile.Dependencies.Deps[d.Name] = tempDeps
}

err = kclPkg.UpdateModAndLockFile()
if err != nil {
return nil, err
Expand Down

0 comments on commit b86884d

Please sign in to comment.