Skip to content

Commit f92c52e

Browse files
committed
docs: update automation docs and examples
Signed-off-by: peefy <[email protected]>
1 parent 988aeb8 commit f92c52e

File tree

7 files changed

+76
-11
lines changed

7 files changed

+76
-11
lines changed

docs/user_docs/guides/automation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ override_spec: [[pkgpath] ":"] identifier ("=" value | "-")
9292
Run the command to update the application name.
9393

9494
```bash
95-
kcl main.k -O app.name='new_app'
95+
kcl main.k -O app.name=\'new_app\'
9696
```
9797

9898
The output is
@@ -111,7 +111,7 @@ We can see the `name` attribute of the `app` config is updated to `new_app`.
111111
Besides, when we use KCL CLI `-d` argument, the KCL file will be modified to the following content at the same time.
112112

113113
```bash
114-
kcl main.k -O app.name='new_app' -d
114+
kcl main.k -O app.name=\'new_app\' -d
115115
```
116116

117117
```python

examples/automation/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
update:
2-
kcl main.k -O app.name='new_app'
2+
kcl main.k -O app.name=\'new_app\'
33

44
delete:
55
kcl main.k -O app.labels.key-

i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/automation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ override_spec: [[pkgpath] ":"] identifier ("=" value | "-")
9292
执行如下命令可以更新应用名称:
9393

9494
```bash
95-
kcl main.k -O app.name='new_app'
95+
kcl main.k -O app.name=\'new_app\'
9696
```
9797

9898
输出为
@@ -111,7 +111,7 @@ app:
111111
此外,当我们使用 KCL CLI `-d` 参数时,KCL 文件将同时修改为以下内容
112112

113113
```bash
114-
kcl main.k -O app.name='new_app' -d
114+
kcl main.k -O app.name=\'new_app\' -d
115115
```
116116

117117
```python

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.8/reference/xlang-api/java-api.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,23 @@ sidebar_position: 5
44

55
# Java API
66

7-
目前 KCL Java SDK 还处于早期预览版本,后续 KCL 团队会持续更新并提供更丰富的功能,更多信息请参阅:[https://github.com/kcl-lang/kcl-java](https://github.com/kcl-lang/kcl-java)
7+
## 添加依赖
8+
9+
```shell
10+
npm install kcl-lib
11+
```
12+
13+
### Maven
14+
15+
## 快速开始
16+
17+
```typescript
18+
import { execProgram, ExecProgramArgs } from "kcl-lib";
19+
20+
function main() {
21+
const result = execProgram(new ExecProgramArgs(["path/to/kcl.k"]));
22+
console.log(result.yamlResult);
23+
}
24+
25+
main();
26+
```

i18n/zh-CN/docusaurus-plugin-content-docs/version-0.8/user_docs/guides/automation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ override_spec: [[pkgpath] ":"] identifier ("=" value | "-")
9292
执行如下命令可以更新应用名称:
9393

9494
```bash
95-
kcl main.k -O app.name='new_app'
95+
kcl main.k -O app.name=\'new_app\'
9696
```
9797

9898
输出为
@@ -111,7 +111,7 @@ app:
111111
此外,当我们使用 KCL CLI `-d` 参数时,KCL 文件将同时修改为以下内容
112112

113113
```bash
114-
kcl main.k -O app.name='new_app' -d
114+
kcl main.k -O app.name=\'new_app\' -d
115115
```
116116

117117
```python

versioned_docs/version-0.8/reference/xlang-api/java-api.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,50 @@ sidebar_position: 5
44

55
# Java API
66

7-
At present, the KCL Java SDK is still in the early preview version. The KCL team will continue to update and provide more functions in the future. For more information, see [https://github.com/kcl-lang/kcl-java](https://github.com/kcl-lang/kcl-java)
7+
## Installation
8+
9+
Refer to [this](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-to-github-packages
10+
) to configure your Maven; set up your GitHub account and Token in the `settings.xml`.
11+
12+
### Maven
13+
14+
In your project's pom.xml, configure our repository as follows:
15+
16+
```xml
17+
<repositories>
18+
<repository>
19+
<id>github</id>
20+
<url>https://maven.pkg.github.com/kcl-lang/*</url>
21+
<snapshots>
22+
<enabled>true</enabled>
23+
</snapshots>
24+
</repository>
25+
</repositories>
26+
```
27+
28+
This way you'll be able to import the above dependency to use the SDK.
29+
30+
```xml
31+
<dependency>
32+
<groupId>com.kcl</groupId>
33+
<artifactId>kcl-lib</artifactId>
34+
<version>0.8.5</version>
35+
</dependency>
36+
```
37+
38+
## Quick Start
39+
40+
```java
41+
import com.kcl.api.API;
42+
import com.kcl.api.Spec.ExecProgram_Args;
43+
import com.kcl.api.Spec.ExecProgram_Result;
44+
45+
public class ExecProgramTest {
46+
public static void main(String[] args) throws Exception {
47+
API api = new API();
48+
ExecProgram_Result result = api
49+
.execProgram(ExecProgram_Args.newBuilder().addKFilenameList("path/to/kcl.k").build());
50+
System.out.println(result.getYamlResult());
51+
}
52+
}
53+
```

versioned_docs/version-0.8/user_docs/guides/automation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ override_spec: [[pkgpath] ":"] identifier ("=" value | "-")
9292
Run the command to update the application name.
9393

9494
```bash
95-
kcl main.k -O app.name='new_app'
95+
kcl main.k -O app.name=\'new_app\'
9696
```
9797

9898
The output is
@@ -111,7 +111,7 @@ We can see the `name` attribute of the `app` config is updated to `new_app`.
111111
Besides, when we use KCL CLI `-d` argument, the KCL file will be modified to the following content at the same time.
112112

113113
```bash
114-
kcl main.k -O app.name='new_app' -d
114+
kcl main.k -O app.name=\'new_app\' -d
115115
```
116116

117117
```python

0 commit comments

Comments
 (0)