Skip to main content
Version: Next

kcl mod add

Add a dependency to a kcl package.

Usage

kcl mod add [options][package_reference]

Description

kcl mod add will add a dependency to a kcl package. The dependency can be from a git repository, or a kcl registry.

package_reference is a kcl package reference, looks like package_name:version.

options

--git

Specify the git url of the dependency from a git repository.

--tag

Specify the tag of the dependency from a git repository.

--help, -h

Show help for kcl mod add command.

Examples

Add a dependency from kcl registry

Add kcl dependency named k8s to the current package.The version of the dependency will be the latest version.

kcl mod add k8s

Add kcl dependency named 'k8s' with version 'v1.27.2'.

kcl mod add k8s:1.29

Add a dependency from git repository

Add kcl dependency named konfig with version v0.4.0 from git repository.

kcl mod add --git https://github.com/kcl-lang/konfig.git --tag v0.4.0

Reference

This command adds new dependency

Usage:
kcl mod add [flags]

Examples:
# 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 by git url
kcl mod add git://github.com/kcl-lang/konfig --tag v0.4.0

# Add the module dependency from the OCI Registry by oci url
kcl mod add oci://ghcr.io/kcl-lang/helloworld --tag 0.1.0

# Add the module dependency from the local file system by file url
kcl mod add /path/to/another_module

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

# Add the module dependency from the OCI Registry by flag
kcl mod add --oci https://ghcr.io/kcl-lang/helloworld --tag 0.1.0

Flags:
--branch string git repository branch
--commit string git repository commit
--git string git repository url
-h, --help help for add
--no_sum_check do not check the checksum of the package and update kcl.mod.lock
--oci string oci repository url
--rename string rename the dependency
--tag string git or oci repository tag

Global Flags:
-q, --quiet Set the quiet mode (no output)