kcl-lang / cli

The KCL Command Line Interface (CLI).
https://kcl-lang.io
Apache License 2.0
19 stars 14 forks source link

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

Closed zong-zhe closed 7 months ago

zong-zhe commented 7 months ago

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