github.com/KusionStack/kpm@v0.8.4-0.20240326033734-dc72298a30e5/docs/command-reference/2.add.md (about)

     1  # kpm add
     2  
     3  Add a dependency to a kcl package.
     4  
     5  ## Usage
     6  
     7  ```shell
     8  kpm add [options][package_reference]
     9  ```
    10  
    11  ## Description
    12  
    13  `kpm add` will add a dependency to a kcl package. The dependency can be from a git repository, or a kcl registry.
    14  
    15  `package_reference` is a kcl package reference, looks like `package_name:version`.
    16  
    17  ## options
    18  
    19  ### --git
    20  
    21  Specify the git url of the dependency from a git repository.
    22  
    23  ### --tag
    24  
    25  Specify the tag of the dependency from a git repository.
    26  
    27  ### --help, -h
    28  
    29  Show help for `kpm add` command.
    30  
    31  ## Examples
    32  
    33  ### Add a dependency from kcl registry
    34  
    35  Add kcl dependency named `k8s` to the current package.The version of the dependency will be the latest version.
    36  
    37  ```shell
    38  kpm add k8s
    39  ```
    40  
    41  Add kcl dependency named 'k8s' with version '1.27'.
    42  
    43  ```shell
    44  kpm add k8s:1.27
    45  ```
    46  
    47  ### Add a dependency from git repository
    48  
    49  Add kcl dependency named `konfig` with version `v0.1.0` from git repository.
    50  
    51  ```shell
    52  kpm add --git https://github.com/awesome-kusion/konfig.git --tag v0.1.0
    53  ```