Skip to content

Commit 6e77a1e

Browse files
authored
chore: update the install approaches in kcl-openapi quick-start guide (#40)
1 parent 96d285d commit 6e77a1e

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

README.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,36 @@ Main use cases:
2020

2121
### Install
2222

23-
+ Since kcl openapi tool is packaged with kusion distribution, and we highly recommend you
24-
to [install the Kusion tools package](https://kusionstack.io/docs/user_docs/getting-started/install) which contains the KCL language
25-
support
26-
and other tools.
23+
The kcl-openapi tool can be installed in both ways:
2724

28-
+ Or we can only install the tool with go install:
25+
- [go install](#1-go-install)
26+
- [curl|sh install (MacOS & Linux)](#2-curlsh-install-macos--linux)
27+
- [download from release](#3-dowload-from-release)
28+
29+
## 1 go install
2930

3031
```shell
3132
go install kcl-lang.io/kcl-openapi@latest
3233
```
3334

35+
## 2 Curl|sh install (MacOS & Linux)
36+
37+
If you don't have go, you can install the CLI with this one-liner:
38+
39+
```shell
40+
curl -fsSL https://kcl-lang.io/script/install-kcl-openapi.sh | /bin/bash
41+
```
42+
43+
## 3 Dowload from release
44+
45+
```shell
46+
# 1. download the released binary from:
47+
# https://github.com/kcl-lang/kcl-openapi/releases
48+
49+
# 2. Unzip the package and add the binary location to PATH
50+
export PATH="<Your directory to store KCLOpenapi binary>:$PATH"
51+
```
52+
3453
## Features
3554

3655
The tool translates Swagger OpenAPI spec and Kubernetes CRD to KCL models.
@@ -42,13 +61,12 @@ tool will extract the defined models from it and generate the corresponding KCL
4261

4362
The command is as follows:
4463

64+
```shell
65+
kcl-openapi generate model -f ${your_open_api_spec} -t ${the_kcl_files_output_dir}
66+
```
4567

46-
```shell
47-
kcl-openapi generate model -f ${your_open_api_spec} -t ${the_kcl_files_output_dir}
48-
```
49-
50-
> **Note**: The Kubernetes API models among all versions are pre-generated, you can directly use it. Please refer the [kpm quick start guide](https://github.com/kcl-lang/kpm#quick-start) for how to pull and use the package.
51-
Alternatively, if you need to generate them yourself, please refer [Generate KCL Packages from Kubernetes OpenAPI Specs](./docs/generate_from_k8s_spec.md).
68+
> **Note**: The [Kubernetes KCL models](https://github.com/orgs/KusionStack/packages/container/package/k8s) among all versions are pre-generated, you get it by executing `kpm add k8s:<version>` under your project. For detailed information about kpm usage, please refer to [kpm quick start guide](https://github.com/kcl-lang/kpm#quick-start).
69+
Alternatively, if you may want to generate them yourself, please refer [Generate KCL Packages from Kubernetes OpenAPI Specs](./docs/generate_from_k8s_spec.md).
5270

5371
### Translate Kubernetes CRD to KCL
5472

@@ -59,9 +77,9 @@ OpenAPI tool will extract the structural schema and generate the corresponding K
5977

6078
The command is as follows:
6179

62-
```shell
63-
kcl-openapi generate model --crd -f ${your_CRD.yaml} -t ${the_kcl_files_output_dir} --skip-validation
64-
```
80+
```shell
81+
kcl-openapi generate model --crd -f ${your_CRD.yaml} -t ${the_kcl_files_output_dir} --skip-validation
82+
```
6583

6684
## KCL OpenAPI Spec
6785

0 commit comments

Comments
 (0)