Skip to content

Commit 3443719

Browse files
committed
chore: sync 0.9 documents
Signed-off-by: peefy <xpf6677@163.com>
1 parent 85960d9 commit 3443719

File tree

12 files changed

+82
-75
lines changed

12 files changed

+82
-75
lines changed

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.9/tools/cli/package-management/command-reference/1.init.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ kcl mod init [options][package_name]
2828

2929
```shell
3030
# 创建一个目录
31-
$ mkdir my_package
31+
mkdir my_package
3232

3333
# 进入目录
34-
$ cd my_package
34+
cd my_package
3535

3636
# 初始化当前目录为 kcl 包
37-
$ kcl mod init
37+
kcl mod init
3838
```
3939

4040
### 初始化一个名为 my_package 的 kcl 包

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.9/tools/cli/package-management/command-reference/8.push.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ kcl mod push [options][kpm_registry]
3030

3131
```shell
3232
# 创建一个 kcl 包
33-
$ kcl mod init <package_name>
33+
kcl mod init <package_name>
3434
# 进入 kcl 包目录
35-
$ cd <package_name>
35+
cd <package_name>
3636
# 上传 kcl 包到 kcl mod registry
37-
$ kcl mod push <oci_url>
37+
kcl mod push <oci_url>
3838
```
3939

4040
### 上传一个 `*.tar` 文件到 kcl mod registry

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.9/user_docs/getting-started/kcl-quick-start.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ servers = [
6565

6666
其中 `#` 开头的表示行注释。`owner` 的 value 是一个字典,字典的面值通过 `{}` 方式包含的内容,字典内部的 key-value 和 `hello = "KCL"` 例子的写法类似。`database` 则是另一个字典,其中字典属性的 value 出现了布尔 `True`、列表 `[]` 和 `{}` 字典,其中列表和字典中还出现了数值类型的 value。 最后一个 `servers` 属性则是一个列表,列表内部嵌套着字典(字典和列表以及后续将要讲到的 `schema` 都可以相互嵌套)。
6767

68-
该配置输出的 YAML 结果如下:
68+
运行命令和配置输出的 YAML 结果如下:
69+
70+
```shell
71+
kcl server.k
72+
```
6973

7074
```yaml
71-
$ kcl server.k
7275
title: KCL Example
7376
owner:
7477
name: The KCL Authors

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.9/user_docs/guides/package-management/4-how-to/4-share_your_pkg.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ kcl mod init my_package
4747

4848
```shell
4949
# 在 exist_kcl_package 目录下
50-
$ pwd
50+
pwd
5151
/home/user/exist_kcl_package
5252

5353
# 执行 kcl 包管理init 命令来创建 kcl.mod 和 kcl.mod.lock
54-
$ kcl mod init
54+
kcl mod init
5555
```
5656

5757
关于如何使用 kcl 包管理init 的更多信息,请参阅 [kcl mod init](https://kcl-lang.io/zh-CN/docs/tools/cli/package-management/command-reference/init)
@@ -62,11 +62,11 @@ $ kcl mod init
6262

6363
```shell
6464
# 在 exist_kcl_package 包的根目录下
65-
$ pwd
65+
pwd
6666
/home/user/exist_kcl_package
6767

6868
# 推送 kcl 包到默认的 OCI Registry
69-
$ kcl mod push
69+
kcl mod push
7070
```
7171

7272
完成上述步骤后,您就成功地将您的 kcl 包推送到了默认的 OCI Registry 中。

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.9/user_docs/guides/package-management/4-how-to/9-kpm_oci.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ KCL 包管理工具的配置文件位于 `$KCL_PKG_PATH/.kpm/config/kpm.json`,
6161
#### 1. 使用账户和密码登陆 OCI Registry
6262

6363
```shell
64-
$ kcl registry login -u <account_name> -p <password> <oci_registry>
64+
kcl registry login -u <account_name> -p <password> <oci_registry>
6565
Login succeeded
6666
```
6767

@@ -74,23 +74,23 @@ kcl registry login -u test -p 1234 localhost:5001
7474
#### 2. 使用账户登陆 OCI Registry,并且交互式输入密码
7575

7676
```shell
77-
$ kcl registry login -u <account_name> <oci_registry>
77+
kcl registry login -u <account_name> <oci_registry>
7878
Password:
7979
Login succeeded
8080
```
8181

8282
对我们的示例来说,命令如下:
8383

8484
```shell
85-
$ kcl registry login -u test localhost:5001
85+
kcl registry login -u test localhost:5001
8686
Password: 1234
8787
Login succeeded
8888
```
8989

9090
#### 3. 交互式输入账户和密码登陆 OCI Registry
9191

9292
```shell
93-
$ kcl registry login <oci_registry>
93+
kcl registry login <oci_registry>
9494
Username: <account_name>
9595
Password:
9696
Login succeeded
@@ -99,7 +99,7 @@ Login succeeded
9999
对我们的示例来说,命令如下:
100100

101101
```shell
102-
$ kcl registry login localhost:5001
102+
kcl registry login localhost:5001
103103
Username: test
104104
Password: 1234
105105
Login succeeded
@@ -125,38 +125,38 @@ kcl registry logout localhost:5001
125125

126126
```shell
127127
# 创建一个新的 kcl 包。
128-
$ kcl mod init <package_name>
128+
kcl mod init <package_name>
129129
# 进入 kcl 包的根目录
130-
$ cd <package_name>
130+
cd <package_name>
131131
# 将 kcl 包上传到一个 oci registry
132-
$ kcl mod push
132+
kcl mod push
133133
```
134134

135135
对于示例来说,命令如下:
136136

137137
```shell
138-
$ kcl mod init MyPkg
139-
$ cd MyPkg
140-
$ kcl mod push
138+
kcl mod init MyPkg
139+
cd MyPkg
140+
kcl mod push
141141
```
142142

143143
你也可以在 `kcl mod push` 命令中指定 OCI registry 的 url。
144144

145145
```shell
146146
# 创建一个新的 kcl 包。
147-
$ kcl mod init <package_name>
147+
kcl mod init <package_name>
148148
# 进入 kcl 包的根目录
149-
$ cd <package_name>
149+
cd <package_name>
150150
# 将 kcl 包上传到一个 oci registry
151-
$ kcl mod push <oci_url>
151+
kcl mod push <oci_url>
152152
```
153153

154154
对于示例来说,您可以通过命令来 push kcl 包到 localhost:5001 中
155155

156156
```shell
157-
$ kcl mod init MyPkg
158-
$ cd MyPkg
159-
$ kcl mod push oci://localhost:5001/test/MyPkg --tag v0.1.0
157+
kcl mod init MyPkg
158+
cd MyPkg
159+
kcl mod push oci://localhost:5001/test/MyPkg --tag v0.1.0
160160
```
161161

162162
### kcl mod pull

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.9/user_docs/support/faq-kcl.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,7 @@ print("The value of a is", a)
19461946
assert a == 1
19471947
```
19481948

1949-
此外,还可以借助 kcl-test 测试工具编写 KCL 内部编写测试用例
1949+
此外,还可以借助 kcl test 测试工具编写 KCL 内部编写测试用例
19501950

19511951
假设有 hello.k 文件,代码如下:
19521952

@@ -1964,26 +1964,27 @@ hello = Person {
19641964
构造 hello_test.k 测试文件,内容如下:
19651965

19661966
```python
1967-
schema TestPerson:
1967+
test_person = lambda {
19681968
a = Person{}
19691969
assert a.name == 'kcl'
1970+
}
19701971

1971-
schema TestPerson_age:
1972+
test_person_age = lambda {
19721973
a = Person{}
19731974
assert a.age == 1
1975+
}
19741976

1975-
schema TestPerson_ok:
1977+
test_person_name_and_age = lambda {
19761978
a = Person{}
19771979
assert a.name == "kcl"
19781980
assert a.age == 1
1981+
}
19791982
```
19801983

1981-
然后在目录下执行 kcl-test 命令:
1984+
然后在目录下执行 kcl test 命令:
19821985

19831986
```
1984-
$ kcl-test
1985-
ok /pkg/to/app [365.154142ms]
1986-
$
1987+
kcl test
19871988
```
19881989

19891990
## 44. KCL 中如何定义函数或定义方法?

versioned_docs/version-0.9/tools/cli/package-management/command-reference/1.init.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ Show help for `kcl mod init` command.
2828

2929
```shell
3030
# create an empty directory
31-
$ mkdir my_package
31+
mkdir my_package
3232

3333
# cd into the directory
34-
$ cd my_package
34+
cd my_package
3535

3636
# init the current directory into a kcl package
37-
$ kcl mod init
37+
kcl mod init
3838
```
3939

4040
### Init a kcl package with a name

versioned_docs/version-0.9/tools/cli/package-management/command-reference/8.push.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ You can use `kcl mod push` under the kcl package root directory to upload a kcl
3030

3131
```shell
3232
# create a new kcl package.
33-
$ kcl mod init <package_name>
33+
kcl mod init <package_name>
3434
# enter the kcl package root directory
35-
$ cd <package_name>
35+
cd <package_name>
3636
# push it to an oci registry
37-
$ kcl mod push <oci_url>
37+
kcl mod push <oci_url>
3838
```
3939

4040
### push a tar to the registry

versioned_docs/version-0.9/user_docs/getting-started/kcl-quick-start.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ servers = [
6565

6666
where `#` begins with a line comment. The value of `owner` is a dictionary. The value of the dictionary contains the content in the form of `{}`. The key-value inside the dictionary is similar to the `hello = "KCL"` example. `database` is another dictionary in which the value of the dictionary attribute appears boolean `True`, list `[]` and dictionary `{}`, in which the value of the numeric type also appears in the list and dictionary. The `servers` attribute is a list with dictionaries nested inside the list (dictionaries and lists, as well as the `schema` that will be discussed later, can be nested within each other).
6767

68-
The YAML output of this configuration is as follows:
68+
The command and the YAML output of this configuration is as follows:
69+
70+
```shell
71+
kcl server.k
72+
```
6973

7074
```yaml
71-
$ kcl server.k
7275
title: KCL Example
7376
owner:
7477
name: The KCL Authors

versioned_docs/version-0.9/user_docs/guides/package-management/4-how-to/4-share_your_pkg.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ If you already have a directory containing kcl files `exist_kcl_package`, you ca
4747

4848
```shell
4949
# In the exist_kcl_package directory
50-
$ pwd
50+
pwd
5151
/home/user/exist_kcl_package
5252

5353
# Run the `kcl mod init` command to create the `kcl.mod` and `kcl.mod.lock` files
54-
$ kcl mod init
54+
kcl mod init
5555
```
5656

5757
For more information on how to use `kcl mod init`, see [kcl mod init](https://kcl-lang.io/docs/tools/cli/package-management/command-reference/init).
@@ -62,11 +62,11 @@ You can use the following command in the root directory of your `kcl` package:
6262

6363
```shell
6464
# In the root directory of the exist_kcl_package package
65-
$ pwd
65+
pwd
6666
/home/user/exist_kcl_package
6767

6868
# Pushing the KCL Package to Default OCI Registry
69-
$ kcl mod push
69+
kcl mod push
7070
```
7171

7272
After completing these steps, you have successfully pushed your KCL Package to the default OCI Registry.

0 commit comments

Comments
 (0)