Skip to content

Commit

Permalink
Merge pull request #84 from Peefy/feat-kcl-mod-rename-and-no-sum-chec…
Browse files Browse the repository at this point in the history
…k-flag

feat: add rename and no_sum_check flags for kcl mod command
  • Loading branch information
Peefy authored May 22, 2024
2 parents 2759a3e + 60d4e5f commit 0496002
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
7 changes: 6 additions & 1 deletion cmd/kcl/commands/mod_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ func NewModAddCmd(cli *client.KpmClient) *cobra.Command {
cmd.Flags().StringVar(&git, "git", "", "git repository location")
cmd.Flags().StringVar(&tag, "tag", "", "git repository tag")
cmd.Flags().StringVar(&commit, "commit", "", "git repository commit")
cmd.Flags().StringVar(&rename, "rename", "", "rename the dependency")
cmd.Flags().BoolVarP(&quiet, "quiet", "q", false, "quiet (no output)")
cmd.Flags().BoolVar(&noSumCheck, "no_sum_check", false, "rename the dependency")
cmd.Flags().BoolVar(&noSumCheck, "no_sum_check", false, "do not check the checksum of the package and update kcl.mod.lock")

return cmd
}
Expand Down Expand Up @@ -145,11 +146,15 @@ func parseAddOptions(cli *client.KpmClient, localPath string, args []string) (*o
return &opt.AddOptions{
LocalPath: localPath,
RegistryOpts: *ociReg,
NoSumCheck: noSumCheck,
NewPkgName: rename,
}, nil
} else {
return &opt.AddOptions{
LocalPath: localPath,
RegistryOpts: *localPkg,
NoSumCheck: noSumCheck,
NewPkgName: rename,
}, nil
}
}
Expand Down
5 changes: 4 additions & 1 deletion cmd/kcl/commands/mod_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ func NewModUpdateCmd(cli *client.KpmClient) *cobra.Command {
},
SilenceUsage: true,
}

cmd.Flags().BoolVar(&noSumCheck, "no_sum_check", false, "do not check the checksum of the package and update kcl.mod.lock")

return cmd
}

Expand All @@ -45,7 +48,7 @@ func ModUpdate(cli *client.KpmClient, args []string) error {
}
pkgPath = pwd
}

cli.SetNoSumCheck(noSumCheck)
kclPkg, err := cli.LoadPkgFromPath(pkgPath)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
kcl-lang.io/kcl-go v0.9.0-alpha.1.0.20240520022521-00adadd8c6f2
kcl-lang.io/kcl-openapi v0.6.1
kcl-lang.io/kcl-playground v0.5.1
kcl-lang.io/kpm v0.8.7-0.20240520061008-9fc4c5efc8c7
kcl-lang.io/kpm v0.8.7-0.20240521132742-0b0b423fb4eb
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1774,8 +1774,8 @@ kcl-lang.io/kcl-openapi v0.6.1 h1:iPH0EvPgDGZS5Lk00/Su5Av6AQP5IBG8f7gAUyevkHE=
kcl-lang.io/kcl-openapi v0.6.1/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.8.7-0.20240520061008-9fc4c5efc8c7 h1:UIVIkVASk2QbWJW6zLJWE2Dm77LuNG3HupqSWJ+Vnh8=
kcl-lang.io/kpm v0.8.7-0.20240520061008-9fc4c5efc8c7/go.mod h1:mM+FrmWUvymso0Mp1vigrEUbL+recig5WAA5rzmcnkc=
kcl-lang.io/kpm v0.8.7-0.20240521132742-0b0b423fb4eb h1:udxv22ZQxe/ZMEFuyzskam6kSqJx4mHDH4NMI8vjl50=
kcl-lang.io/kpm v0.8.7-0.20240521132742-0b0b423fb4eb/go.mod h1:mM+FrmWUvymso0Mp1vigrEUbL+recig5WAA5rzmcnkc=
kcl-lang.io/lib v0.9.0-alpha.1.0.20240520020338-198f8ebdb26a h1:409hMK27VF3VE9Z9cznHPVGyB4Ohvc2RxIcyU49jAmI=
kcl-lang.io/lib v0.9.0-alpha.1.0.20240520020338-198f8ebdb26a/go.mod h1:ubsalGXxJaa5II/EsHmsI/tL2EluYHIcW+BwzQPt+uY=
oras.land/oras-go v1.2.5 h1:XpYuAwAb0DfQsunIyMfeET92emK8km3W4yEzZvUbsTo=
Expand Down

0 comments on commit 0496002

Please sign in to comment.