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

     1  # kpm init
     2  
     3  Init a kcl package.
     4  
     5  ## Usage
     6  
     7  ```shell
     8  kpm init [options][package_name]
     9  ```
    10  
    11  ## Description
    12  
    13  `kpm init` will initialize a kcl package in the current directory. If the package name is not provided, the name of the current directory will be used.
    14  
    15  If the package name is provided, a subdirectory with the name of the package will be created and the package will be initialized in that directory.
    16  
    17  `kpm init` will create `kcl.mod`, `kcl.mod.lock` and `main.k` under the package directory.
    18  
    19  ## Options
    20  
    21  ### --help, -h
    22  
    23  Show help for `kpm init` command.
    24  
    25  ## Examples
    26  
    27  ### Init a kcl package with a name
    28  
    29  ```shell
    30  # init a kcl package with a name 'my_package'
    31  kpm init my_package
    32  ```
    33  
    34  ### Init the current directory into a kcl package
    35  
    36  ```shell
    37  # create an empty directory
    38  $ mkdir my_package 
    39  
    40  # cd into the directory
    41  $ cd my_package
    42  
    43  # init the current directory into a kcl package
    44  $ kpm init
    45  ```