kcl-lang/cli

Enhancement: `kcl mod add` supports add the dependeny for oci by oci url

Closed this issue · 0 comments

Enhancement

Currently, the following commands in kcl mod add are supported to add dependencies.

# Add the module dependency named "k8s"
kcl mod add k8s

# Add the module dependency named "k8s" with the version "1.28"
kcl mod add k8s:1.28

# Add the module dependency from the GitHub
kcl mod add --git https://github.com/kcl-lang/konfig --tag v0.4.0

# Add a local dependency
kcl mod add /path/to/another_module`

For KCL packages from OCI, the command kcl mod add k8s can only use the default OCI registry, which is not flexible enough, so we decided to add the OCI Url to support downloading third-party dependencies from different OCI registries.

At the same time, align the kcl mod add command with the kcl mod run command style. The adjusted commands for adding git and oci dependencies are shown as follows.

# For oci 
kcl mod add oci://ghcr.io/kcl-lang/helloworld

# For git
kcl mod add git://ghcr.io/kcl-lang/helloworld