From c8318404cc138f83b48b616dbedb14a0fcd1f46c Mon Sep 17 00:00:00 2001 From: peefy Date: Tue, 25 Jul 2023 15:52:06 +0800 Subject: [PATCH] feat: split code block cmd input and output for the convenience of copying commands. --- .../index.md | 18 +++++++--- blog/2023-04-14-kcl-0.4.6-release/index.md | 21 ++++++++++-- .../index.md | 18 +++++++--- blog/2023-05-20-vs-kustomize/index.md | 33 ++++++++++++++----- blog/2023-05-30-vs-helm/index.md | 27 +++++++++++---- blog/2023-06-05-k8s-sidecar-1/index.md | 8 ++--- blog/2023-07-14-kcl-0.5.0-release/index.md | 6 ++-- .../command-reference/6.login.md | 21 ++++++++++-- docs/reference/xlang-api/overview.md | 4 +-- docs/tools/cli/kcl/vet.md | 10 +++--- .../getting-started/kcl-quick-start.md | 15 +++++++-- docs/user_docs/guides/abstraction.md | 14 ++++++-- .../guides/ci-integration/2-gitlab-ci.md | 4 +-- docs/user_docs/guides/data-integration.md | 16 ++++++--- docs/user_docs/guides/schema-definition.md | 18 +++++++--- .../2-generate-k8s-manifests.md | 16 ++++++--- .../index.md | 4 +-- .../index.md | 4 +-- .../2023-05-20-vs-kustomize/index.md | 8 ++--- .../2023-06-05-k8s-sidecar-1/index.md | 8 ++--- .../2023-07-14-kcl-0.5.0-release/index.md | 6 ++-- .../command-reference/6.login.md | 21 ++++++++++-- .../current/reference/xlang-api/overview.md | 4 +-- .../current/reference/xlang-api/rest-api.md | 14 ++++++-- .../current/tools/cli/kcl/vet.md | 6 ++-- .../getting-started/kcl-quick-start.md | 14 ++++++-- .../current/user_docs/guides/abstraction.md | 14 ++++++-- .../user_docs/guides/data-integration.md | 16 ++++++--- .../user_docs/guides/schema-definition.md | 9 +++-- .../2-generate-k8s-manifests.md | 16 ++++++--- .../user_docs/guides/data-integration.md | 6 ++-- .../user_docs/guides/schema-definition.md | 4 +-- .../user_docs/guides/validation.md | 2 +- .../generate_k8s_manifests.md | 4 +-- .../reference/xlang-api/overview.md | 4 +-- .../user_docs/guides/data-integration.md | 6 ++-- .../user_docs/guides/schema-definition.md | 4 +-- .../user_docs/guides/validation.md | 2 +- .../generate_k8s_manifests.md | 4 +-- .../guides/working-with-k8s/vs_kustomize.md | 8 ++--- .../reference/xlang-api/overview.md | 4 +-- .../user_docs/guides/data-integration.md | 6 ++-- .../user_docs/guides/schema-definition.md | 4 +-- .../user_docs/guides/validation.md | 2 +- .../generate_k8s_manifests.md | 4 +-- .../guides/working-with-k8s/vs_kustomize.md | 8 ++--- .../reference/xlang-api/overview.md | 4 +-- .../version-0.4.6/tools/cli/kcl/vet.md | 6 ++-- .../user_docs/guides/data-integration.md | 4 +-- .../user_docs/guides/schema-definition.md | 2 +- .../generate_k8s_manifests.md | 4 +-- .../guides/working-with-k8s/vs_kustomize.md | 8 ++--- .../command-reference/6.login.md | 21 ++++++++++-- .../reference/xlang-api/overview.md | 4 +-- .../reference/xlang-api/rest-api.md | 14 ++++++-- .../version-0.5.0/tools/cli/kcl/vet.md | 6 ++-- .../getting-started/kcl-quick-start.md | 14 ++++++-- .../user_docs/guides/abstraction.md | 14 ++++++-- .../user_docs/guides/data-integration.md | 16 ++++++--- .../user_docs/guides/schema-definition.md | 9 +++-- .../2-generate-k8s-manifests.md | 16 ++++++--- .../user_docs/guides/data-integration.md | 6 ++-- .../user_docs/guides/schema-definition.md | 4 +-- .../generate_k8s_manifests.md | 4 +-- .../reference/xlang-api/overview.md | 4 +-- .../user_docs/guides/data-integration.md | 6 ++-- .../user_docs/guides/schema-definition.md | 4 +-- .../generate_k8s_manifests.md | 4 +-- .../guides/working-with-k8s/vs_helm.md | 6 ++-- .../guides/working-with-k8s/vs_kustomize.md | 8 ++--- .../reference/xlang-api/overview.md | 4 +-- .../user_docs/guides/data-integration.md | 6 ++-- .../user_docs/guides/schema-definition.md | 4 +-- .../generate_k8s_manifests.md | 4 +-- .../guides/working-with-k8s/vs_helm.md | 6 ++-- .../guides/working-with-k8s/vs_kustomize.md | 8 ++--- .../reference/xlang-api/overview.md | 4 +-- .../version-0.4.6/tools/cli/kcl/vet.md | 6 ++-- .../user_docs/guides/data-integration.md | 4 +-- .../user_docs/guides/schema-definition.md | 4 +-- .../generate_k8s_manifests.md | 4 +-- .../guides/working-with-k8s/vs_helm.md | 6 ++-- .../guides/working-with-k8s/vs_kustomize.md | 8 ++--- .../command-reference/6.login.md | 21 ++++++++++-- .../reference/xlang-api/overview.md | 4 +-- .../version-0.5.0/tools/cli/kcl/vet.md | 10 +++--- .../getting-started/kcl-quick-start.md | 15 +++++++-- .../user_docs/guides/abstraction.md | 14 ++++++-- .../guides/ci-integration/2-gitlab-ci.md | 4 +-- .../user_docs/guides/data-integration.md | 16 ++++++--- .../user_docs/guides/schema-definition.md | 18 +++++++--- .../2-generate-k8s-manifests.md | 16 ++++++--- 92 files changed, 581 insertions(+), 258 deletions(-) diff --git a/blog/2022-12-06-kcl-0.4.4-release-blog/index.md b/blog/2022-12-06-kcl-0.4.4-release-blog/index.md index e2e43f38..ba28decf 100644 --- a/blog/2022-12-06-kcl-0.4.4-release-blog/index.md +++ b/blog/2022-12-06-kcl-0.4.4-release-blog/index.md @@ -128,8 +128,13 @@ x1 = Person { Execute the following command and get the output: -```bash -$ python3 -m kclvm hello.k +```shell +python3 -m kclvm hello.k +``` + +The expect output is + +```yaml name: kcl age: 1 x0: @@ -155,8 +160,13 @@ print(planner.plan(kclvm_exec.Run(["hello.k"]).filter_by_path_selector())) Execute the following command and get the output: -```bash -$ python3 main.py +```shell +python3 main.py +``` + +The expect output is + +```yaml name: kcl age: 1 x0: diff --git a/blog/2023-04-14-kcl-0.4.6-release/index.md b/blog/2023-04-14-kcl-0.4.6-release/index.md index a56e82cc..c7e69513 100644 --- a/blog/2023-04-14-kcl-0.4.6-release/index.md +++ b/blog/2023-04-14-kcl-0.4.6-release/index.md @@ -49,7 +49,12 @@ metadata = { Execute the following KCL command, then you can see the syntax errors including the unterminated string and the brace mismatch errors. ```shell -$ kcl main.k +kcl main.k +``` + +The output is + +```shell error[E1001]: InvalidSyntax --> main.k:2:21 | @@ -121,7 +126,12 @@ person = Person { We run the following command: ```shell -$ kcl main.k -S person +kcl main.k -S person +``` + +The output is + +```yaml name: Alice age: 18 ``` @@ -215,7 +225,12 @@ apps.Deployment { Execute the following command to run the KCL code to obtain an nginx deployment YAML output. ```shell -$ kpm run +kpm run +``` + +The output is + +```yaml apiVersion: apps/v1 kind: Deployment metadata: diff --git a/blog/2023-04-27-new-version-feature-interpretation-kclvm-go-feature-overview/index.md b/blog/2023-04-27-new-version-feature-interpretation-kclvm-go-feature-overview/index.md index 171bdf40..f2cd0a81 100644 --- a/blog/2023-04-27-new-version-feature-interpretation-kclvm-go-feature-overview/index.md +++ b/blog/2023-04-27-new-version-feature-interpretation-kclvm-go-feature-overview/index.md @@ -58,8 +58,13 @@ spec = { And then execute the KCL directly from the command line with: -```bash -$ kcl-go run ./hello.k +```shell +kcl-go run ./hello.k +``` + +The output is + +```yaml apiVersion: apps/v1 kind: Deployment metadata: @@ -112,8 +117,13 @@ go get kusionstack.io/kclvm-go@main The following command runs the Go program: -```bash -$ go run main.go +```shell +go run main.go +``` + +The output is + +```yaml apiVersion: apps/v1 kind: Deployment metadata: diff --git a/blog/2023-05-20-vs-kustomize/index.md b/blog/2023-05-20-vs-kustomize/index.md index 0f1457f3..5a8cb4ce 100644 --- a/blog/2023-05-20-vs-kustomize/index.md +++ b/blog/2023-05-20-vs-kustomize/index.md @@ -111,8 +111,13 @@ The base directory stores the basic deployment configuration, and the prod envir We can display the real deployment configuration of the prod environment through the following command. -```bash -$ kubectl kustomize ./prod +```shell +kubectl kustomize ./prod +``` + +The output is + +```yaml apiVersion: apps/v1 kind: Deployment metadata: @@ -149,9 +154,13 @@ spec: We can also directly apply the configuration to the cluster through the following command. -```bash -$ kubectl apply -k ./prod +```shell +kubectl apply -k ./prod +``` + +The output is +```shell deployment.apps/ldap created ``` @@ -244,17 +253,25 @@ diff prod-deployment.yaml deployment.yaml Of course, we can also use KCL tools together with kubectl and other tools to apply the configuration of the production environment to the cluster -```bash -$ kcl main.k -D env=prod | kubectl apply -f - +```shell +kcl main.k -D env=prod | kubectl apply -f - +``` + +The output is +```shell deployment.apps/ldap created ``` Finally, check the deployment status through kubectl -```bash -$ kubectl get deploy +```shell +kubectl get deploy +``` + +The output is +```shell NAME READY UP-TO-DATE AVAILABLE AGE ldap 0/6 6 0 15s ``` diff --git a/blog/2023-05-30-vs-helm/index.md b/blog/2023-05-30-vs-helm/index.md index 4ded013a..08da7c6c 100644 --- a/blog/2023-05-30-vs-helm/index.md +++ b/blog/2023-05-30-vs-helm/index.md @@ -364,8 +364,13 @@ We can get the `Deployment` and `Service` resources throw the following command: + `Deployment` -```bash -$ kcl workload-kcl/deployment.k -Y workload-kcl/kcl.yaml +```shell +kcl workload-kcl/deployment.k -Y workload-kcl/kcl.yaml +``` + +The output is + +```yaml apiVersion: apps/v1 kind: Deployment metadata: @@ -401,8 +406,13 @@ spec: + `Service` -```bash -$ kcl workload-kcl/service.k -Y workload-kcl/kcl.yaml +```shell +kcl workload-kcl/service.k -Y workload-kcl/kcl.yaml +``` + +The output is + +```yaml apiVersion: v1 kind: Service metadata: @@ -425,8 +435,13 @@ spec: In addition, we can overwrite the value in the `kcl.yaml` file with the `-D` parameter, such as executing the following command. -```bash -$ kcl workload-kcl/service.k -Y workload-kcl/kcl.yaml -D service=None +```shell +kcl workload-kcl/service.k -Y workload-kcl/kcl.yaml -D service=None +``` + +The output is + +```yaml apiVersion: v1 kind: Service metadata: diff --git a/blog/2023-06-05-k8s-sidecar-1/index.md b/blog/2023-06-05-k8s-sidecar-1/index.md index 2130efbe..f4e5a839 100644 --- a/blog/2023-06-05-k8s-sidecar-1/index.md +++ b/blog/2023-06-05-k8s-sidecar-1/index.md @@ -36,7 +36,7 @@ spec: The `Pod` is then created via the kubectl, and then the `Pod` execution status is viewed via `kubectl get po`. -```bash +```shell $ kubectl create -f pod.yaml $ kubectl get po NAME READY STATUS RESTARTS AGE @@ -45,7 +45,7 @@ web-app 1/1 Running 0 45m You can see that a `Pod` named `web-app` is up and running properly, containing the `Nginx` service. To configure port forwarding for external access, the port 3999 of the host corresponds to port 80 of the master container: -```bash +```shell $ kubectl port-forward web-app 3999:80 Forwarding from 127.0.0.1:3999 ->80 Forwarding from [::1]:3999 -> 80 @@ -59,7 +59,7 @@ Port forwarding is a blocking procedure, keep the command line open. Then open t In this section, we try to add the ability to customize web pages to the `Nginx` service via Sidecar without modifying the original `Nginx` container image. Before we start, remove the previously started `Pod`: -```bash +```shell $ kubectl delete po web-app pod "web-app" deleted ``` @@ -113,7 +113,7 @@ The `Busybox` has only one function: it overwrites the `/var/log/index.html` fil Then restart the Pod and remap the local host port to the container port. -```bash +```shell $ kubectl create -f pod.yaml pod/web-app created $ kubectl port-forward web-app 3999:80 diff --git a/blog/2023-07-14-kcl-0.5.0-release/index.md b/blog/2023-07-14-kcl-0.5.0-release/index.md index 6c238737..3ae078dd 100644 --- a/blog/2023-07-14-kcl-0.5.0-release/index.md +++ b/blog/2023-07-14-kcl-0.5.0-release/index.md @@ -229,7 +229,7 @@ kcl-openapi generate model -f processed-${spec_path} The expected execution output of the script is the corresponding version of the KCL Kubernetes model, and the generated path is `/models/k8s`. -```bash +```shell $ tree models/k8s models/k8s ├── api @@ -290,7 +290,7 @@ apps.Deployment { By combining the `kpm run` and `kubectl` command lines, we can directly distribute resource configurations to the cluster. -```bash +```shell $ kpm run | kubectl apply -f - deployment.apps/nginx-deployment configured @@ -420,7 +420,7 @@ spec: In the above configuration, we used a Kubernetes web service application abstract model that has been predetermined on OCI `oci://ghcr.io/kcl-lang/web-service` and configured the required configuration fields for the model through the `params` field. The original Kubernetes YAML output can be obtained and applied by executing the following command: -```bash +```shell $ kubectl kcl apply -f krm-kcl-abstration.yaml deployment.apps/app created diff --git a/docs/reference/package-management/command-reference/6.login.md b/docs/reference/package-management/command-reference/6.login.md index 228353cf..68ca0f1b 100644 --- a/docs/reference/package-management/command-reference/6.login.md +++ b/docs/reference/package-management/command-reference/6.login.md @@ -31,14 +31,24 @@ Show help for `kpm login` command. ### login to a registry with account and password ```shell -$ kpm login -u -p +kpm login -u -p +``` + +The output is + +```shell Login succeeded ``` ### login to a registry with account, and enter the password interactively ```shell -$ kpm login -u +kpm login -u +``` + +The output is + +```shell Password: Login succeeded ``` @@ -46,7 +56,12 @@ Login succeeded ### login to a registry, and enter the account and password interactively ```shell -$ kpm login +kpm login +``` + +The output is + +```shell Username: Password: Login succeeded diff --git a/docs/reference/xlang-api/overview.md b/docs/reference/xlang-api/overview.md index 605fc899..65b8e679 100644 --- a/docs/reference/xlang-api/overview.md +++ b/docs/reference/xlang-api/overview.md @@ -135,7 +135,7 @@ x1 = Person { Execute the following command and get the output: -```bash +```shell $ python3 -m kclvm hello.k name: kcl age: 1 @@ -162,7 +162,7 @@ print(planner.plan(kclvm_exec.Run(["hello.k"]).filter_by_path_selector())) Execute the following command and get the output: -```bash +```shell $ python3 main.py name: kcl age: 1 diff --git a/docs/tools/cli/kcl/vet.md b/docs/tools/cli/kcl/vet.md index e68f6b36..e17f8bf3 100644 --- a/docs/tools/cli/kcl/vet.md +++ b/docs/tools/cli/kcl/vet.md @@ -49,21 +49,21 @@ schema Data: Execute the following command: -```bash -$ kcl-vet data.json schema.k +```shell +kcl-vet data.json schema.k ``` ## Specify the schema for validation When multiple schema definitions exist in the KCL file, by default, the KCL Validation tool will use the first schema to check. If you need to specify a schema for verification, you can use the `-d|--schema` parameter -```bash -$ kcl-vet data.json schema.k -d User +```shell +kcl-vet data.json schema.k -d User ``` ## Args -```bash +```shell $ kcl-vet -h USAGE: kcl-vet [OPTIONS] [ARGS] diff --git a/docs/user_docs/getting-started/kcl-quick-start.md b/docs/user_docs/getting-started/kcl-quick-start.md index b233b98d..807ac893 100644 --- a/docs/user_docs/getting-started/kcl-quick-start.md +++ b/docs/user_docs/getting-started/kcl-quick-start.md @@ -21,7 +21,13 @@ Set the `hello` attribute to the `"KCL"` string. Then save the code to the `hell How to execute this program depends on the specific development environment, we first assume that the local macOS or Linux system has installed the `kcl` command (or enter the **Docker** environment test by `docker run --rm -it kcllang/kcl`) and then run the following command: ```shell -$ kcl hello.k +kcl hello.k +``` + +The output is + + +```yaml hello: KCL ``` @@ -123,7 +129,12 @@ database = DatabaseConfig { When executed, an error similar to the following will be generated (the displayed file path depends on the local environment): ```shell -$ kcl server.k +kcl server.k +``` + +The output is + +```shell error[E2G22]: TypeError --> /path/to/server.k:8:5 | diff --git a/docs/user_docs/guides/abstraction.md b/docs/user_docs/guides/abstraction.md index e134c679..a2053556 100644 --- a/docs/user_docs/guides/abstraction.md +++ b/docs/user_docs/guides/abstraction.md @@ -73,7 +73,12 @@ Besides, KCL allows developers to define the resources required for their applic If we want to transform the application config into the docker compose config, we can run the command simply: ```shell -$ kcl main.k docker_compose_render.k +kcl main.k docker_compose_render.k +``` + +The output is + +```yaml services: app: image: ngnix @@ -88,7 +93,12 @@ services: If we want to transform the application config into the Kubernetes manifests, we can run the command simply: ```shell -$ kcl main.k kubernetes_render.k +kcl main.k kubernetes_render.k +``` + +The output is + +```yaml apiVersion: apps/v1 kind: Deployment metadata: diff --git a/docs/user_docs/guides/ci-integration/2-gitlab-ci.md b/docs/user_docs/guides/ci-integration/2-gitlab-ci.md index 96fa0a3d..de4f5ce5 100644 --- a/docs/user_docs/guides/ci-integration/2-gitlab-ci.md +++ b/docs/user_docs/guides/ci-integration/2-gitlab-ci.md @@ -21,6 +21,8 @@ The overall workflow is as follows: We put the application source code and infrastructure deployment code in different repos, which can be maintained by different roles to achieve the separation of concerns. +### 1. Get the Example + + Get the application code ```shell @@ -28,8 +30,6 @@ git clone https://gitlab.com/kcl-lang/flask-demo.git/ cd flask-demo ``` -## Summary - This is a web application written in Python. We can use the `Dockerfile` in the application directory to generate a container image of this application, and also use Gitlab CI to automatically build a image named `flask_demo`, the CI configuration is as follows ```yaml diff --git a/docs/user_docs/guides/data-integration.md b/docs/user_docs/guides/data-integration.md index 154b2a92..fa35de9e 100644 --- a/docs/user_docs/guides/data-integration.md +++ b/docs/user_docs/guides/data-integration.md @@ -44,8 +44,13 @@ server_yaml = yaml.encode({ In the above code, we use the built-in `yaml` module of KCL and its `yaml.decode` function directly integrates YAML data, and uses the `Server` schema to directly verify the integrated YAML data. In addition, we can use `yaml.encode` to serialize YAML data. We can obtain the configuration output through the following command: -```bash -$ kcl yaml.k +```shell +kcl yaml.k +``` + +The output is + +```yaml server: ports: - 80 @@ -77,8 +82,11 @@ server_json = json.encode({ The output of the execution command is: -```bash -$ kcl json.k +```shell +kcl json.k +``` + +```yaml server: ports: - 80 diff --git a/docs/user_docs/guides/schema-definition.md b/docs/user_docs/guides/schema-definition.md index a8839de4..e802276f 100644 --- a/docs/user_docs/guides/schema-definition.md +++ b/docs/user_docs/guides/schema-definition.md @@ -90,8 +90,13 @@ In the above file, we use the `schema` keyword to define three models `App`, `Se We can get the YAML output of the `app` instance by using the following command line -```bash -$ kcl main.k +```shell +kcl main.k +``` + +The output is + +```yaml app: domainType: Standard containerPort: 80 @@ -107,8 +112,13 @@ app: We can still get the YAML output of the `app` instance by using the following command line -```bash -$ kcl main.k +```shell +kcl main.k +``` + +The output is + +```yaml app: domainType: Standard containerPort: 80 diff --git a/docs/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md b/docs/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md index 89f9dada..b517a3b0 100644 --- a/docs/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md +++ b/docs/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md @@ -120,9 +120,13 @@ spec: Of course, we can use KCL together with kubectl and other tools. Let's execute the following commands and see the result: -```bash -$ kcl main.k | kubectl apply -f - +```shell +kcl main.k | kubectl apply -f - +``` + +The output is +```shell deployment.apps/nginx-deployment configured ``` @@ -130,9 +134,13 @@ It can be seen from the command line that it is completely consistent with the d Check the deployment status through kubectl -```bash -$ kubectl get deploy +```shell +kubectl get deploy +``` + +The output is +```shell NAME READY UP-TO-DATE AVAILABLE AGE nginx-deployment 3/3 3 3 15s ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-blog/2022-12-06-kcl-0.4.4-release-blog/index.md b/i18n/zh-CN/docusaurus-plugin-content-blog/2022-12-06-kcl-0.4.4-release-blog/index.md index 251c5471..22c35ed6 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-blog/2022-12-06-kcl-0.4.4-release-blog/index.md +++ b/i18n/zh-CN/docusaurus-plugin-content-blog/2022-12-06-kcl-0.4.4-release-blog/index.md @@ -128,7 +128,7 @@ x1 = Person { 执行如下命令并获得输出: -```bash +```shell $ python3 -m kclvm hello.k name: kcl age: 1 @@ -155,7 +155,7 @@ print(planner.plan(kclvm_exec.Run(["hello.k"]).filter_by_path_selector())) 执行如下命令并获得输出: -```bash +```shell $ python3 main.py name: kcl age: 1 diff --git a/i18n/zh-CN/docusaurus-plugin-content-blog/2023-04-27-new-version-feature-interpretation-kclvm-go-feature-overview/index.md b/i18n/zh-CN/docusaurus-plugin-content-blog/2023-04-27-new-version-feature-interpretation-kclvm-go-feature-overview/index.md index f0dca9a2..37043839 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-blog/2023-04-27-new-version-feature-interpretation-kclvm-go-feature-overview/index.md +++ b/i18n/zh-CN/docusaurus-plugin-content-blog/2023-04-27-new-version-feature-interpretation-kclvm-go-feature-overview/index.md @@ -60,7 +60,7 @@ spec = { 之后可以直接在命令行中执行 KCL -```bash +```shell $ kcl-go run ./hello.k apiVersion: apps/v1 kind: Deployment @@ -114,7 +114,7 @@ go get kusionstack.io/kclvm-go@main 执行 Go 程序,结果为: -```bash +```shell $ go run main.go name: kcl age: 1 diff --git a/i18n/zh-CN/docusaurus-plugin-content-blog/2023-05-20-vs-kustomize/index.md b/i18n/zh-CN/docusaurus-plugin-content-blog/2023-05-20-vs-kustomize/index.md index 3f1b4f4b..b79061a2 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-blog/2023-05-20-vs-kustomize/index.md +++ b/i18n/zh-CN/docusaurus-plugin-content-blog/2023-05-20-vs-kustomize/index.md @@ -111,7 +111,7 @@ EOF 我们可以通过如下命令行显示 prod 环境的真实 deployment 配置 -```bash +```shell $ kubectl kustomize ./prod apiVersion: apps/v1 kind: Deployment @@ -149,7 +149,7 @@ spec: 也可以通过如下命令行直接将配置下发到集群当中 -```bash +```shell $ kubectl apply -k ./prod deployment.apps/ldap created @@ -244,7 +244,7 @@ diff prod-deployment.yaml deployment.yaml 当然我们也可以将 KCL 工具与 kubectl 等工具结合使用,将生产环境的配置下发到集群当中 -```bash +```shell $ kcl main.k -D env=prod | kubectl apply -f - deployment.apps/ldap created @@ -254,7 +254,7 @@ deployment.apps/ldap created 最后,通过 kubectl 检查部署状态 -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/i18n/zh-CN/docusaurus-plugin-content-blog/2023-06-05-k8s-sidecar-1/index.md b/i18n/zh-CN/docusaurus-plugin-content-blog/2023-06-05-k8s-sidecar-1/index.md index f9021598..fa3a1e65 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-blog/2023-06-05-k8s-sidecar-1/index.md +++ b/i18n/zh-CN/docusaurus-plugin-content-blog/2023-06-05-k8s-sidecar-1/index.md @@ -31,7 +31,7 @@ spec: 然后通过 `kubectl create` 命令行工具创建 `Pod`,然后通过 `kubectl get po` 查看 `Pod` 执行状态: -```bash +```shell $ kubectl create -f pod.yaml $ kubectl get po NAME READY STATUS RESTARTS AGE @@ -40,7 +40,7 @@ web-app 1/1 Running 0 45m 可以看到一个名为 `web-app` 的 `Pod` 已经正常启动并运行,其中包含 `Nginx` 服务。为了便于外部访问配置端口转发,将宿主的 3999 端口对应到主容器的 80 端口: -```bash +```shell $ kubectl port-forward web-app 3999:80 Forwarding from 127.0.0.1:3999 ->80 Forwarding from [::1]:3999 -> 80 @@ -54,7 +54,7 @@ Forwarding from [::1]:3999 -> 80 现在我们尝试在不修改原始 `Nginx` 容器镜像的前提下,通过 `Sidecar` 模式为 `Nginx` 服务增加定制 `Web` 页面的能力。在开始前先删除之前启动的 `Pod`: -```bash +```shell $ kubectl delete po web-app pod "web-app" deleted ``` @@ -107,7 +107,7 @@ done 然后重新启动 `Pod`,并重新映射本地宿主机端口到容器端口: -```bash +```shell $ kubectl create -f pod.yaml pod/web-app created $ kubectl port-forward web-app 3999:80 diff --git a/i18n/zh-CN/docusaurus-plugin-content-blog/2023-07-14-kcl-0.5.0-release/index.md b/i18n/zh-CN/docusaurus-plugin-content-blog/2023-07-14-kcl-0.5.0-release/index.md index b10f4e67..32df64f5 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-blog/2023-07-14-kcl-0.5.0-release/index.md +++ b/i18n/zh-CN/docusaurus-plugin-content-blog/2023-07-14-kcl-0.5.0-release/index.md @@ -230,7 +230,7 @@ kcl-openapi generate model -f processed-${spec_path} 脚本预期的执行输出为对应版本的 KCL Kubernetes 模型,生成的路径为 `<工作空间路径>/models/k8s` -```bash +```shell $ tree models/k8s models/k8s ├── api @@ -292,7 +292,7 @@ apps.Deployment { 通过 `kpm run` 和 `kubectl` 命令行结合使用,我们可以直接将资源配置下发到集群 -```bash +```shell $ kpm run | kubectl apply -f - deployment.apps/nginx-deployment configured @@ -422,7 +422,7 @@ spec: 在上述配置中,我们使用了在 OCI 上已经预定好的一个 Kubernetes Web 服务应用抽象模型 `oci://ghcr.io/kcl-lang/web-service`, 并通过 `params` 字段配置了该模型所需的配置字段。通过执行如下命令可以获得原始的 Kubernetes YAML 输出并下发到集群: -```bash +```shell $ kubectl kcl apply -f krm-kcl-abstration.yaml deployment.apps/app created diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/package-management/command-reference/6.login.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/package-management/command-reference/6.login.md index 45bf47b8..9055d8fb 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/package-management/command-reference/6.login.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/package-management/command-reference/6.login.md @@ -31,14 +31,24 @@ kpm login [options][kpm_registry] ### 登陆到 kpm registry, 通过参数输入用户名和密码 ```shell -$ kpm login -u -p +kpm login -u -p +``` + +期望输出为 + +```shell Login succeeded ``` ### 登陆到 kpm registry, 通过参数输入用户名,密码通过交互式输入 ```shell -$ kpm login -u +kpm login -u +``` + +期望输出为 + +```shell Password: Login succeeded ``` @@ -46,7 +56,12 @@ Login succeeded ### 登陆到 kpm registry, 用户名和密码通过交互式输入 ```shell -$ kpm login +kpm login +``` + +期望输出为 + +```shell Username: Password: Login succeeded diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/xlang-api/overview.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/xlang-api/overview.md index aa5eac42..928aa759 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/xlang-api/overview.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/xlang-api/overview.md @@ -247,7 +247,7 @@ x1 = Person { 执行如下命令并获得输出: -```bash +```shell $ python3 -m kclvm hello.k name: kcl age: 1 @@ -274,7 +274,7 @@ print(planner.plan(kclvm_exec.Run(["hello.k"]).filter_by_path_selector())) 执行如下命令并获得输出: -```bash +```shell $ python3 main.py name: kcl age: 1 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/xlang-api/rest-api.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/xlang-api/rest-api.md index e4fafe17..6667b1a1 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/xlang-api/rest-api.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/xlang-api/rest-api.md @@ -22,7 +22,12 @@ kcl-go rest-server 然后可以通过 POST 协议请求服务: ```shell -$ curl -X POST http://127.0.0.1:2021/api:protorpc/BuiltinService.Ping --data '{}' +curl -X POST http://127.0.0.1:2021/api:protorpc/BuiltinService.Ping --data '{}' +``` + +期望输出为 + +```shell { "error": "", "result": {} @@ -104,10 +109,15 @@ message ValidateCode_Args { 将该 JSON 数据保存到 `vet-hello.json` 文件,然后通过以下命令进行校验: ```shell -$ curl -X POST \ +curl -X POST \ http://127.0.0.1:2021/api:protorpc/KclvmService.ValidateCode \ -H "accept: application/json" \ --data @./vet-hello.json +``` + +如果看到输出 + +```json { "error": "", "result": { diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/vet.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/vet.md index 71279c3f..bdf7558a 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/vet.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/vet.md @@ -49,7 +49,7 @@ schema Data: 在目录下执行如下命令 -```bash +```shell $ kcl-vet data.json schema.k ``` @@ -57,13 +57,13 @@ $ kcl-vet data.json schema.k 当校验的 KCL 文件中存在多个 schema 定义时,kcl-vet 工具会默认取第一个 schema 定义进行校验,如果需要指定校验的 schema,可以使用 `-d|--schema` 参数 -```bash +```shell $ kcl-vet data.json schema.k -d User ``` ## 命令行参数 -```bash +```shell $ kcl-vet -h USAGE: kcl-vet [OPTIONS] [ARGS] diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/getting-started/kcl-quick-start.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/getting-started/kcl-quick-start.md index 403675df..c30c6845 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/getting-started/kcl-quick-start.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/getting-started/kcl-quick-start.md @@ -21,7 +21,12 @@ hello = "KCL" 如何执行这个程序取决于具体的开发环境,我们先假设本地的 macOS 或者是 Linux 系统已经安装了 `kcl` 命令(或者通过 `docker run --rm -it kcllang/kcl` 进入 Docker 环境测试)。然后在文件所在的目录命令行输入以下命令执行: ```shell -$ kcl hello.k +kcl hello.k +``` + +输出为 + +```yaml hello: KCL ``` @@ -123,7 +128,12 @@ database = DatabaseConfig { 执行时将产生类似以下的错误(显示的文件路径和本地环境有关): ```shell -$ kcl server.k +kcl server.k +``` + +输出为 + +```shell error[E2G22]: TypeError --> /path/to/server.k:8:5 | diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/abstraction.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/abstraction.md index c2f17db8..23b1f3fc 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/abstraction.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/abstraction.md @@ -71,7 +71,12 @@ app.App { 如果我们想将应用程序配置转换为 Docker Compose 配置,我们可以简单地运行如下命令: ```shell -$ kcl main.k docker_compose_render.k +kcl main.k docker_compose_render.k +``` + +输出为 + +```yaml services: app: image: ngnix @@ -86,7 +91,12 @@ services: 如果我们想将应用程序配置转换为 Kubernetes 清单,我们可以简单地运行如下命令: ```shell -$ kcl main.k kubernetes_render.k +kcl main.k kubernetes_render.k +``` + +输出为 + +```yaml apiVersion: apps/v1 kind: Deployment metadata: diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/data-integration.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/data-integration.md index e94541a5..9ad80639 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/data-integration.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/data-integration.md @@ -44,8 +44,13 @@ server_yaml = yaml.encode({ 我们通过如下命令可以获得配置输出: -```bash -$ kcl yaml.k +```shell +kcl yaml.k +``` + +输出为 + +```yaml server: ports: - 80 @@ -77,8 +82,11 @@ server_json = json.encode({ 执行命令输出为: -```bash -$ kcl json.k +```shell +kcl json.k +``` + +```yaml server: ports: - 80 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/schema-definition.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/schema-definition.md index e28ecb9b..a1b32ada 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/schema-definition.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/schema-definition.md @@ -90,8 +90,13 @@ schema Volume: 我们可以使用如下命令行可以获得 `app` 实例的 YAML 输出 -```bash -$ kcl main.k +```shell +kcl main.k +``` + +输出为 + +```yaml app: domainType: Standard containerPort: 80 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md index 0ddb5007..b8c0fa93 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md @@ -120,9 +120,13 @@ spec: 当然我们可以将 KCL 工具与 kubectl 等工具结合使用,让我们执行如下命令并看看效果 -```bash -$ kcl main.k | kubectl apply -f - +```shell +kcl main.k | kubectl apply -f - +``` + +输出为 +```shell deployment.apps/nginx-deployment configured ``` @@ -130,9 +134,13 @@ deployment.apps/nginx-deployment configured 通过 kubectl 检查部署状态 -```bash -$ kubectl get deploy +```shell +kubectl get deploy +``` + +输出为 +```shell NAME READY UP-TO-DATE AVAILABLE AGE nginx-deployment 3/3 3 3 15s ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/data-integration.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/data-integration.md index 6407f1f0..b10cff6a 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/data-integration.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/data-integration.md @@ -20,7 +20,7 @@ ports: 在上述代码中,我们通过 KCL 内置的 `yaml` 模块以及其中的 `yaml.decode` 直接完成 YAML 数据的集成,并且使用 `Server` schema 对集成的 YAML 数据直接进行校验,我们通过如下命令可以获得配置输出: -```bash +```shell $ kcl main.k server: ports: @@ -40,7 +40,7 @@ server = yaml.encode({ 执行命令输出为: -```bash +```shell $ kcl main.k server: | ports: @@ -61,7 +61,7 @@ server_json_decode = json.decode('{"ports": [80, 8080]}') 执行命令输出为: -```bash +```shell $ kcl main.k server_json_encode: '{"ports": [80, 8080]}' server_json_decode: diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/schema-definition.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/schema-definition.md index f8b15c52..bd35855d 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/schema-definition.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/schema-definition.md @@ -57,7 +57,7 @@ app: App { 我们使用如下命令行可以获得 `app` 实例的 YAML 输出 -```bash +```shell $ kcl main.k app: domainType: Standard @@ -129,7 +129,7 @@ app: app_module.App { 我们使用如下命令行仍然可以获得 `app` 实例的 YAML 输出 -```bash +```shell $ kcl main.k app: domainType: Standard diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/validation.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/validation.md index 62f79860..c1ebd404 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/validation.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/validation.md @@ -93,7 +93,7 @@ schema Data: 执行如下命令获得校验结果 -```bash +```shell $ kcl-vet data.json schema.k Validate succuss! ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/working-with-k8s/generate_k8s_manifests.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/working-with-k8s/generate_k8s_manifests.md index 13bee094..77babf26 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/working-with-k8s/generate_k8s_manifests.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.3/user_docs/guides/working-with-k8s/generate_k8s_manifests.md @@ -154,7 +154,7 @@ spec: 当然我们可以将 KCL 工具与 kubectl 等工具结合使用,让我们执行如下命令并看看效果 -```bash +```shell $ kcl main.k | kubectl apply -f - deployment.apps/nginx-deployment configured @@ -164,7 +164,7 @@ deployment.apps/nginx-deployment configured 通过 kubectl 检查部署状态 -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/reference/xlang-api/overview.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/reference/xlang-api/overview.md index ff9d5f93..7f76b9c1 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/reference/xlang-api/overview.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/reference/xlang-api/overview.md @@ -251,7 +251,7 @@ x1 = Person { 执行如下命令并获得输出: -```bash +```shell $ python3 -m kclvm hello.k name: kcl age: 1 @@ -278,7 +278,7 @@ print(planner.plan(kclvm_exec.Run(["hello.k"]).filter_by_path_selector())) 执行如下命令并获得输出: -```bash +```shell $ python3 main.py name: kcl age: 1 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/data-integration.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/data-integration.md index 6407f1f0..b10cff6a 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/data-integration.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/data-integration.md @@ -20,7 +20,7 @@ ports: 在上述代码中,我们通过 KCL 内置的 `yaml` 模块以及其中的 `yaml.decode` 直接完成 YAML 数据的集成,并且使用 `Server` schema 对集成的 YAML 数据直接进行校验,我们通过如下命令可以获得配置输出: -```bash +```shell $ kcl main.k server: ports: @@ -40,7 +40,7 @@ server = yaml.encode({ 执行命令输出为: -```bash +```shell $ kcl main.k server: | ports: @@ -61,7 +61,7 @@ server_json_decode = json.decode('{"ports": [80, 8080]}') 执行命令输出为: -```bash +```shell $ kcl main.k server_json_encode: '{"ports": [80, 8080]}' server_json_decode: diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/schema-definition.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/schema-definition.md index f8b15c52..bd35855d 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/schema-definition.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/schema-definition.md @@ -57,7 +57,7 @@ app: App { 我们使用如下命令行可以获得 `app` 实例的 YAML 输出 -```bash +```shell $ kcl main.k app: domainType: Standard @@ -129,7 +129,7 @@ app: app_module.App { 我们使用如下命令行仍然可以获得 `app` 实例的 YAML 输出 -```bash +```shell $ kcl main.k app: domainType: Standard diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/validation.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/validation.md index 62f79860..c1ebd404 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/validation.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/validation.md @@ -93,7 +93,7 @@ schema Data: 执行如下命令获得校验结果 -```bash +```shell $ kcl-vet data.json schema.k Validate succuss! ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/working-with-k8s/generate_k8s_manifests.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/working-with-k8s/generate_k8s_manifests.md index 13bee094..77babf26 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/working-with-k8s/generate_k8s_manifests.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/working-with-k8s/generate_k8s_manifests.md @@ -154,7 +154,7 @@ spec: 当然我们可以将 KCL 工具与 kubectl 等工具结合使用,让我们执行如下命令并看看效果 -```bash +```shell $ kcl main.k | kubectl apply -f - deployment.apps/nginx-deployment configured @@ -164,7 +164,7 @@ deployment.apps/nginx-deployment configured 通过 kubectl 检查部署状态 -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/working-with-k8s/vs_kustomize.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/working-with-k8s/vs_kustomize.md index 60e34889..1031e240 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/working-with-k8s/vs_kustomize.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.4/user_docs/guides/working-with-k8s/vs_kustomize.md @@ -106,7 +106,7 @@ EOF 我们可以通过如下命令行显示 prod 环境的真实 deployment 配置 -```bash +```shell $ kubectl kustomize ./prod apiVersion: apps/v1 kind: Deployment @@ -144,7 +144,7 @@ spec: 也可以通过如下命令行直接将配置下发到集群当中 -```bash +```shell $ kubectl apply -k ./prod deployment.apps/ldap created @@ -239,7 +239,7 @@ diff prod-deployment.yaml deployment.yaml 当然我们也可以将 KCL 工具与 kubectl 等工具结合使用,将生产环境的配置下发到集群当中 -```bash +```shell $ kcl main.k -D env=prod | kubectl apply -f - deployment.apps/ldap created @@ -249,7 +249,7 @@ deployment.apps/ldap created 最后,通过 kubectl 检查部署状态 -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/reference/xlang-api/overview.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/reference/xlang-api/overview.md index ff9d5f93..7f76b9c1 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/reference/xlang-api/overview.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/reference/xlang-api/overview.md @@ -251,7 +251,7 @@ x1 = Person { 执行如下命令并获得输出: -```bash +```shell $ python3 -m kclvm hello.k name: kcl age: 1 @@ -278,7 +278,7 @@ print(planner.plan(kclvm_exec.Run(["hello.k"]).filter_by_path_selector())) 执行如下命令并获得输出: -```bash +```shell $ python3 main.py name: kcl age: 1 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/data-integration.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/data-integration.md index 6407f1f0..b10cff6a 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/data-integration.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/data-integration.md @@ -20,7 +20,7 @@ ports: 在上述代码中,我们通过 KCL 内置的 `yaml` 模块以及其中的 `yaml.decode` 直接完成 YAML 数据的集成,并且使用 `Server` schema 对集成的 YAML 数据直接进行校验,我们通过如下命令可以获得配置输出: -```bash +```shell $ kcl main.k server: ports: @@ -40,7 +40,7 @@ server = yaml.encode({ 执行命令输出为: -```bash +```shell $ kcl main.k server: | ports: @@ -61,7 +61,7 @@ server_json_decode = json.decode('{"ports": [80, 8080]}') 执行命令输出为: -```bash +```shell $ kcl main.k server_json_encode: '{"ports": [80, 8080]}' server_json_decode: diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/schema-definition.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/schema-definition.md index f8b15c52..bd35855d 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/schema-definition.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/schema-definition.md @@ -57,7 +57,7 @@ app: App { 我们使用如下命令行可以获得 `app` 实例的 YAML 输出 -```bash +```shell $ kcl main.k app: domainType: Standard @@ -129,7 +129,7 @@ app: app_module.App { 我们使用如下命令行仍然可以获得 `app` 实例的 YAML 输出 -```bash +```shell $ kcl main.k app: domainType: Standard diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/validation.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/validation.md index 62f79860..c1ebd404 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/validation.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/validation.md @@ -93,7 +93,7 @@ schema Data: 执行如下命令获得校验结果 -```bash +```shell $ kcl-vet data.json schema.k Validate succuss! ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/working-with-k8s/generate_k8s_manifests.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/working-with-k8s/generate_k8s_manifests.md index 13bee094..77babf26 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/working-with-k8s/generate_k8s_manifests.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/working-with-k8s/generate_k8s_manifests.md @@ -154,7 +154,7 @@ spec: 当然我们可以将 KCL 工具与 kubectl 等工具结合使用,让我们执行如下命令并看看效果 -```bash +```shell $ kcl main.k | kubectl apply -f - deployment.apps/nginx-deployment configured @@ -164,7 +164,7 @@ deployment.apps/nginx-deployment configured 通过 kubectl 检查部署状态 -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/working-with-k8s/vs_kustomize.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/working-with-k8s/vs_kustomize.md index 60e34889..1031e240 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/working-with-k8s/vs_kustomize.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.5/user_docs/guides/working-with-k8s/vs_kustomize.md @@ -106,7 +106,7 @@ EOF 我们可以通过如下命令行显示 prod 环境的真实 deployment 配置 -```bash +```shell $ kubectl kustomize ./prod apiVersion: apps/v1 kind: Deployment @@ -144,7 +144,7 @@ spec: 也可以通过如下命令行直接将配置下发到集群当中 -```bash +```shell $ kubectl apply -k ./prod deployment.apps/ldap created @@ -239,7 +239,7 @@ diff prod-deployment.yaml deployment.yaml 当然我们也可以将 KCL 工具与 kubectl 等工具结合使用,将生产环境的配置下发到集群当中 -```bash +```shell $ kcl main.k -D env=prod | kubectl apply -f - deployment.apps/ldap created @@ -249,7 +249,7 @@ deployment.apps/ldap created 最后,通过 kubectl 检查部署状态 -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/reference/xlang-api/overview.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/reference/xlang-api/overview.md index 007cd181..e0c2def0 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/reference/xlang-api/overview.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/reference/xlang-api/overview.md @@ -252,7 +252,7 @@ x1 = Person { 执行如下命令并获得输出: -```bash +```shell $ python3 -m kclvm hello.k name: kcl age: 1 @@ -279,7 +279,7 @@ print(planner.plan(kclvm_exec.Run(["hello.k"]).filter_by_path_selector())) 执行如下命令并获得输出: -```bash +```shell $ python3 main.py name: kcl age: 1 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/tools/cli/kcl/vet.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/tools/cli/kcl/vet.md index 71279c3f..bdf7558a 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/tools/cli/kcl/vet.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/tools/cli/kcl/vet.md @@ -49,7 +49,7 @@ schema Data: 在目录下执行如下命令 -```bash +```shell $ kcl-vet data.json schema.k ``` @@ -57,13 +57,13 @@ $ kcl-vet data.json schema.k 当校验的 KCL 文件中存在多个 schema 定义时,kcl-vet 工具会默认取第一个 schema 定义进行校验,如果需要指定校验的 schema,可以使用 `-d|--schema` 参数 -```bash +```shell $ kcl-vet data.json schema.k -d User ``` ## 命令行参数 -```bash +```shell $ kcl-vet -h USAGE: kcl-vet [OPTIONS] [ARGS] diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/data-integration.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/data-integration.md index e94541a5..89ac1c1a 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/data-integration.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/data-integration.md @@ -44,7 +44,7 @@ server_yaml = yaml.encode({ 我们通过如下命令可以获得配置输出: -```bash +```shell $ kcl yaml.k server: ports: @@ -77,7 +77,7 @@ server_json = json.encode({ 执行命令输出为: -```bash +```shell $ kcl json.k server: ports: diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/schema-definition.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/schema-definition.md index e28ecb9b..0899cd67 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/schema-definition.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/schema-definition.md @@ -90,7 +90,7 @@ schema Volume: 我们可以使用如下命令行可以获得 `app` 实例的 YAML 输出 -```bash +```shell $ kcl main.k app: domainType: Standard diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/working-with-k8s/generate_k8s_manifests.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/working-with-k8s/generate_k8s_manifests.md index 13bee094..77babf26 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/working-with-k8s/generate_k8s_manifests.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/working-with-k8s/generate_k8s_manifests.md @@ -154,7 +154,7 @@ spec: 当然我们可以将 KCL 工具与 kubectl 等工具结合使用,让我们执行如下命令并看看效果 -```bash +```shell $ kcl main.k | kubectl apply -f - deployment.apps/nginx-deployment configured @@ -164,7 +164,7 @@ deployment.apps/nginx-deployment configured 通过 kubectl 检查部署状态 -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/working-with-k8s/vs_kustomize.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/working-with-k8s/vs_kustomize.md index 60e34889..1031e240 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/working-with-k8s/vs_kustomize.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.4.6/user_docs/guides/working-with-k8s/vs_kustomize.md @@ -106,7 +106,7 @@ EOF 我们可以通过如下命令行显示 prod 环境的真实 deployment 配置 -```bash +```shell $ kubectl kustomize ./prod apiVersion: apps/v1 kind: Deployment @@ -144,7 +144,7 @@ spec: 也可以通过如下命令行直接将配置下发到集群当中 -```bash +```shell $ kubectl apply -k ./prod deployment.apps/ldap created @@ -239,7 +239,7 @@ diff prod-deployment.yaml deployment.yaml 当然我们也可以将 KCL 工具与 kubectl 等工具结合使用,将生产环境的配置下发到集群当中 -```bash +```shell $ kcl main.k -D env=prod | kubectl apply -f - deployment.apps/ldap created @@ -249,7 +249,7 @@ deployment.apps/ldap created 最后,通过 kubectl 检查部署状态 -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/reference/package-management/command-reference/6.login.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/reference/package-management/command-reference/6.login.md index 45bf47b8..9055d8fb 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/reference/package-management/command-reference/6.login.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/reference/package-management/command-reference/6.login.md @@ -31,14 +31,24 @@ kpm login [options][kpm_registry] ### 登陆到 kpm registry, 通过参数输入用户名和密码 ```shell -$ kpm login -u -p +kpm login -u -p +``` + +期望输出为 + +```shell Login succeeded ``` ### 登陆到 kpm registry, 通过参数输入用户名,密码通过交互式输入 ```shell -$ kpm login -u +kpm login -u +``` + +期望输出为 + +```shell Password: Login succeeded ``` @@ -46,7 +56,12 @@ Login succeeded ### 登陆到 kpm registry, 用户名和密码通过交互式输入 ```shell -$ kpm login +kpm login +``` + +期望输出为 + +```shell Username: Password: Login succeeded diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/reference/xlang-api/overview.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/reference/xlang-api/overview.md index aa5eac42..928aa759 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/reference/xlang-api/overview.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/reference/xlang-api/overview.md @@ -247,7 +247,7 @@ x1 = Person { 执行如下命令并获得输出: -```bash +```shell $ python3 -m kclvm hello.k name: kcl age: 1 @@ -274,7 +274,7 @@ print(planner.plan(kclvm_exec.Run(["hello.k"]).filter_by_path_selector())) 执行如下命令并获得输出: -```bash +```shell $ python3 main.py name: kcl age: 1 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/reference/xlang-api/rest-api.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/reference/xlang-api/rest-api.md index e4fafe17..6667b1a1 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/reference/xlang-api/rest-api.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/reference/xlang-api/rest-api.md @@ -22,7 +22,12 @@ kcl-go rest-server 然后可以通过 POST 协议请求服务: ```shell -$ curl -X POST http://127.0.0.1:2021/api:protorpc/BuiltinService.Ping --data '{}' +curl -X POST http://127.0.0.1:2021/api:protorpc/BuiltinService.Ping --data '{}' +``` + +期望输出为 + +```shell { "error": "", "result": {} @@ -104,10 +109,15 @@ message ValidateCode_Args { 将该 JSON 数据保存到 `vet-hello.json` 文件,然后通过以下命令进行校验: ```shell -$ curl -X POST \ +curl -X POST \ http://127.0.0.1:2021/api:protorpc/KclvmService.ValidateCode \ -H "accept: application/json" \ --data @./vet-hello.json +``` + +如果看到输出 + +```json { "error": "", "result": { diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/tools/cli/kcl/vet.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/tools/cli/kcl/vet.md index 71279c3f..bdf7558a 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/tools/cli/kcl/vet.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/tools/cli/kcl/vet.md @@ -49,7 +49,7 @@ schema Data: 在目录下执行如下命令 -```bash +```shell $ kcl-vet data.json schema.k ``` @@ -57,13 +57,13 @@ $ kcl-vet data.json schema.k 当校验的 KCL 文件中存在多个 schema 定义时,kcl-vet 工具会默认取第一个 schema 定义进行校验,如果需要指定校验的 schema,可以使用 `-d|--schema` 参数 -```bash +```shell $ kcl-vet data.json schema.k -d User ``` ## 命令行参数 -```bash +```shell $ kcl-vet -h USAGE: kcl-vet [OPTIONS] [ARGS] diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/getting-started/kcl-quick-start.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/getting-started/kcl-quick-start.md index 403675df..c30c6845 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/getting-started/kcl-quick-start.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/getting-started/kcl-quick-start.md @@ -21,7 +21,12 @@ hello = "KCL" 如何执行这个程序取决于具体的开发环境,我们先假设本地的 macOS 或者是 Linux 系统已经安装了 `kcl` 命令(或者通过 `docker run --rm -it kcllang/kcl` 进入 Docker 环境测试)。然后在文件所在的目录命令行输入以下命令执行: ```shell -$ kcl hello.k +kcl hello.k +``` + +输出为 + +```yaml hello: KCL ``` @@ -123,7 +128,12 @@ database = DatabaseConfig { 执行时将产生类似以下的错误(显示的文件路径和本地环境有关): ```shell -$ kcl server.k +kcl server.k +``` + +输出为 + +```shell error[E2G22]: TypeError --> /path/to/server.k:8:5 | diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/abstraction.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/abstraction.md index c2f17db8..23b1f3fc 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/abstraction.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/abstraction.md @@ -71,7 +71,12 @@ app.App { 如果我们想将应用程序配置转换为 Docker Compose 配置,我们可以简单地运行如下命令: ```shell -$ kcl main.k docker_compose_render.k +kcl main.k docker_compose_render.k +``` + +输出为 + +```yaml services: app: image: ngnix @@ -86,7 +91,12 @@ services: 如果我们想将应用程序配置转换为 Kubernetes 清单,我们可以简单地运行如下命令: ```shell -$ kcl main.k kubernetes_render.k +kcl main.k kubernetes_render.k +``` + +输出为 + +```yaml apiVersion: apps/v1 kind: Deployment metadata: diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/data-integration.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/data-integration.md index e94541a5..9ad80639 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/data-integration.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/data-integration.md @@ -44,8 +44,13 @@ server_yaml = yaml.encode({ 我们通过如下命令可以获得配置输出: -```bash -$ kcl yaml.k +```shell +kcl yaml.k +``` + +输出为 + +```yaml server: ports: - 80 @@ -77,8 +82,11 @@ server_json = json.encode({ 执行命令输出为: -```bash -$ kcl json.k +```shell +kcl json.k +``` + +```yaml server: ports: - 80 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/schema-definition.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/schema-definition.md index e28ecb9b..a1b32ada 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/schema-definition.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/schema-definition.md @@ -90,8 +90,13 @@ schema Volume: 我们可以使用如下命令行可以获得 `app` 实例的 YAML 输出 -```bash -$ kcl main.k +```shell +kcl main.k +``` + +输出为 + +```yaml app: domainType: Standard containerPort: 80 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md index 0ddb5007..b8c0fa93 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.5.0/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md @@ -120,9 +120,13 @@ spec: 当然我们可以将 KCL 工具与 kubectl 等工具结合使用,让我们执行如下命令并看看效果 -```bash -$ kcl main.k | kubectl apply -f - +```shell +kcl main.k | kubectl apply -f - +``` + +输出为 +```shell deployment.apps/nginx-deployment configured ``` @@ -130,9 +134,13 @@ deployment.apps/nginx-deployment configured 通过 kubectl 检查部署状态 -```bash -$ kubectl get deploy +```shell +kubectl get deploy +``` + +输出为 +```shell NAME READY UP-TO-DATE AVAILABLE AGE nginx-deployment 3/3 3 3 15s ``` diff --git a/versioned_docs/version-0.4.3/user_docs/guides/data-integration.md b/versioned_docs/version-0.4.3/user_docs/guides/data-integration.md index 390b0169..6a9ff3ac 100644 --- a/versioned_docs/version-0.4.3/user_docs/guides/data-integration.md +++ b/versioned_docs/version-0.4.3/user_docs/guides/data-integration.md @@ -20,7 +20,7 @@ ports: In the above code, we use the built-in `yaml` module of KCL and its `yaml.decode` function directly integrates YAML data, and uses the `Server` schema to directly verify the integrated YAML data. We can obtain the configuration output through the following command: -```bash +```shell $ kcl main.k server: ports: @@ -40,7 +40,7 @@ server = yaml.encode({ The output of the execution command is: -```bash +```shell $ kcl main.k server: | ports: @@ -61,7 +61,7 @@ server_json_decode = json.decode('{"ports": [80, 8080]}') The output of the execution command is: -```bash +```shell $ kcl main.k server_json_encode: '{"ports": [80, 8080]}' server_json_decode: diff --git a/versioned_docs/version-0.4.3/user_docs/guides/schema-definition.md b/versioned_docs/version-0.4.3/user_docs/guides/schema-definition.md index e73805ba..f3b551a2 100644 --- a/versioned_docs/version-0.4.3/user_docs/guides/schema-definition.md +++ b/versioned_docs/version-0.4.3/user_docs/guides/schema-definition.md @@ -57,7 +57,7 @@ app: App { We can get the YAML output of the `app` instance by using the following command line -```bash +```shell $ kcl main.k app: domainType: Standard @@ -129,7 +129,7 @@ app: app_module.App { We can still get the YAML output of the `app` instance by using the following command line -```bash +```shell $ kcl main.k app: domainType: Standard diff --git a/versioned_docs/version-0.4.3/user_docs/guides/working-with-k8s/generate_k8s_manifests.md b/versioned_docs/version-0.4.3/user_docs/guides/working-with-k8s/generate_k8s_manifests.md index 02ff62c1..8e1bc49e 100644 --- a/versioned_docs/version-0.4.3/user_docs/guides/working-with-k8s/generate_k8s_manifests.md +++ b/versioned_docs/version-0.4.3/user_docs/guides/working-with-k8s/generate_k8s_manifests.md @@ -154,7 +154,7 @@ spec: Of course, we can use KCL together with kubectl and other tools. Let's execute the following commands and see the result: -```bash +```shell $ kcl main.k | kubectl apply -f - deployment.apps/nginx-deployment configured @@ -164,7 +164,7 @@ It can be seen from the command line that it is completely consistent with the d Check the deployment status through kubectl -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/versioned_docs/version-0.4.4/reference/xlang-api/overview.md b/versioned_docs/version-0.4.4/reference/xlang-api/overview.md index 50ebd7dd..268605b5 100644 --- a/versioned_docs/version-0.4.4/reference/xlang-api/overview.md +++ b/versioned_docs/version-0.4.4/reference/xlang-api/overview.md @@ -140,7 +140,7 @@ x1 = Person { Execute the following command and get the output: -```bash +```shell $ python3 -m kclvm hello.k name: kcl age: 1 @@ -167,7 +167,7 @@ print(planner.plan(kclvm_exec.Run(["hello.k"]).filter_by_path_selector())) Execute the following command and get the output: -```bash +```shell $ python3 main.py name: kcl age: 1 diff --git a/versioned_docs/version-0.4.4/user_docs/guides/data-integration.md b/versioned_docs/version-0.4.4/user_docs/guides/data-integration.md index 390b0169..6a9ff3ac 100644 --- a/versioned_docs/version-0.4.4/user_docs/guides/data-integration.md +++ b/versioned_docs/version-0.4.4/user_docs/guides/data-integration.md @@ -20,7 +20,7 @@ ports: In the above code, we use the built-in `yaml` module of KCL and its `yaml.decode` function directly integrates YAML data, and uses the `Server` schema to directly verify the integrated YAML data. We can obtain the configuration output through the following command: -```bash +```shell $ kcl main.k server: ports: @@ -40,7 +40,7 @@ server = yaml.encode({ The output of the execution command is: -```bash +```shell $ kcl main.k server: | ports: @@ -61,7 +61,7 @@ server_json_decode = json.decode('{"ports": [80, 8080]}') The output of the execution command is: -```bash +```shell $ kcl main.k server_json_encode: '{"ports": [80, 8080]}' server_json_decode: diff --git a/versioned_docs/version-0.4.4/user_docs/guides/schema-definition.md b/versioned_docs/version-0.4.4/user_docs/guides/schema-definition.md index e73805ba..f3b551a2 100644 --- a/versioned_docs/version-0.4.4/user_docs/guides/schema-definition.md +++ b/versioned_docs/version-0.4.4/user_docs/guides/schema-definition.md @@ -57,7 +57,7 @@ app: App { We can get the YAML output of the `app` instance by using the following command line -```bash +```shell $ kcl main.k app: domainType: Standard @@ -129,7 +129,7 @@ app: app_module.App { We can still get the YAML output of the `app` instance by using the following command line -```bash +```shell $ kcl main.k app: domainType: Standard diff --git a/versioned_docs/version-0.4.4/user_docs/guides/working-with-k8s/generate_k8s_manifests.md b/versioned_docs/version-0.4.4/user_docs/guides/working-with-k8s/generate_k8s_manifests.md index 02ff62c1..8e1bc49e 100644 --- a/versioned_docs/version-0.4.4/user_docs/guides/working-with-k8s/generate_k8s_manifests.md +++ b/versioned_docs/version-0.4.4/user_docs/guides/working-with-k8s/generate_k8s_manifests.md @@ -154,7 +154,7 @@ spec: Of course, we can use KCL together with kubectl and other tools. Let's execute the following commands and see the result: -```bash +```shell $ kcl main.k | kubectl apply -f - deployment.apps/nginx-deployment configured @@ -164,7 +164,7 @@ It can be seen from the command line that it is completely consistent with the d Check the deployment status through kubectl -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/versioned_docs/version-0.4.4/user_docs/guides/working-with-k8s/vs_helm.md b/versioned_docs/version-0.4.4/user_docs/guides/working-with-k8s/vs_helm.md index 489cbe0a..c7b21a97 100644 --- a/versioned_docs/version-0.4.4/user_docs/guides/working-with-k8s/vs_helm.md +++ b/versioned_docs/version-0.4.4/user_docs/guides/working-with-k8s/vs_helm.md @@ -357,7 +357,7 @@ We can get the `Deployment` and `Service` resources throw the following command: + `Deployment` -```bash +```shell $ kcl workload-kcl/deployment.k -Y workload-kcl/kcl.yaml apiVersion: apps/v1 kind: Deployment @@ -394,7 +394,7 @@ spec: + `Service` -```bash +```shell $ kcl workload-kcl/service.k -Y workload-kcl/kcl.yaml apiVersion: v1 kind: Service @@ -418,7 +418,7 @@ spec: In addition, we can overwrite the value in the `kcl.yaml` file with the `-D` parameter, such as executing the following command. -```bash +```shell $ kcl workload-kcl/service.k -Y workload-kcl/kcl.yaml -D service=None apiVersion: v1 kind: Service diff --git a/versioned_docs/version-0.4.4/user_docs/guides/working-with-k8s/vs_kustomize.md b/versioned_docs/version-0.4.4/user_docs/guides/working-with-k8s/vs_kustomize.md index e245e93d..529f0650 100644 --- a/versioned_docs/version-0.4.4/user_docs/guides/working-with-k8s/vs_kustomize.md +++ b/versioned_docs/version-0.4.4/user_docs/guides/working-with-k8s/vs_kustomize.md @@ -104,7 +104,7 @@ The base directory stores the basic deployment configuration, and the prod envir We can display the real deployment configuration of the prod environment through the following command. -```bash +```shell $ kubectl kustomize ./prod apiVersion: apps/v1 kind: Deployment @@ -142,7 +142,7 @@ spec: We can also directly apply the configuration to the cluster through the following command. -```bash +```shell $ kubectl apply -k ./prod deployment.apps/ldap created @@ -237,7 +237,7 @@ diff prod-deployment.yaml deployment.yaml Of course, we can also use KCL tools together with kubectl and other tools to apply the configuration of the production environment to the cluster -```bash +```shell $ kcl main.k -D env=prod | kubectl apply -f - deployment.apps/ldap created @@ -245,7 +245,7 @@ deployment.apps/ldap created Finally, check the deployment status through kubectl -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/versioned_docs/version-0.4.5/reference/xlang-api/overview.md b/versioned_docs/version-0.4.5/reference/xlang-api/overview.md index 0ae578e2..817957c2 100644 --- a/versioned_docs/version-0.4.5/reference/xlang-api/overview.md +++ b/versioned_docs/version-0.4.5/reference/xlang-api/overview.md @@ -140,7 +140,7 @@ x1 = Person { Execute the following command and get the output: -```bash +```shell $ python3 -m kclvm hello.k name: kcl age: 1 @@ -167,7 +167,7 @@ print(planner.plan(kclvm_exec.Run(["hello.k"]).filter_by_path_selector())) Execute the following command and get the output: -```bash +```shell $ python3 main.py name: kcl age: 1 diff --git a/versioned_docs/version-0.4.5/user_docs/guides/data-integration.md b/versioned_docs/version-0.4.5/user_docs/guides/data-integration.md index 390b0169..6a9ff3ac 100644 --- a/versioned_docs/version-0.4.5/user_docs/guides/data-integration.md +++ b/versioned_docs/version-0.4.5/user_docs/guides/data-integration.md @@ -20,7 +20,7 @@ ports: In the above code, we use the built-in `yaml` module of KCL and its `yaml.decode` function directly integrates YAML data, and uses the `Server` schema to directly verify the integrated YAML data. We can obtain the configuration output through the following command: -```bash +```shell $ kcl main.k server: ports: @@ -40,7 +40,7 @@ server = yaml.encode({ The output of the execution command is: -```bash +```shell $ kcl main.k server: | ports: @@ -61,7 +61,7 @@ server_json_decode = json.decode('{"ports": [80, 8080]}') The output of the execution command is: -```bash +```shell $ kcl main.k server_json_encode: '{"ports": [80, 8080]}' server_json_decode: diff --git a/versioned_docs/version-0.4.5/user_docs/guides/schema-definition.md b/versioned_docs/version-0.4.5/user_docs/guides/schema-definition.md index e73805ba..f3b551a2 100644 --- a/versioned_docs/version-0.4.5/user_docs/guides/schema-definition.md +++ b/versioned_docs/version-0.4.5/user_docs/guides/schema-definition.md @@ -57,7 +57,7 @@ app: App { We can get the YAML output of the `app` instance by using the following command line -```bash +```shell $ kcl main.k app: domainType: Standard @@ -129,7 +129,7 @@ app: app_module.App { We can still get the YAML output of the `app` instance by using the following command line -```bash +```shell $ kcl main.k app: domainType: Standard diff --git a/versioned_docs/version-0.4.5/user_docs/guides/working-with-k8s/generate_k8s_manifests.md b/versioned_docs/version-0.4.5/user_docs/guides/working-with-k8s/generate_k8s_manifests.md index 02ff62c1..8e1bc49e 100644 --- a/versioned_docs/version-0.4.5/user_docs/guides/working-with-k8s/generate_k8s_manifests.md +++ b/versioned_docs/version-0.4.5/user_docs/guides/working-with-k8s/generate_k8s_manifests.md @@ -154,7 +154,7 @@ spec: Of course, we can use KCL together with kubectl and other tools. Let's execute the following commands and see the result: -```bash +```shell $ kcl main.k | kubectl apply -f - deployment.apps/nginx-deployment configured @@ -164,7 +164,7 @@ It can be seen from the command line that it is completely consistent with the d Check the deployment status through kubectl -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/versioned_docs/version-0.4.5/user_docs/guides/working-with-k8s/vs_helm.md b/versioned_docs/version-0.4.5/user_docs/guides/working-with-k8s/vs_helm.md index 0a3b1984..f8de8083 100644 --- a/versioned_docs/version-0.4.5/user_docs/guides/working-with-k8s/vs_helm.md +++ b/versioned_docs/version-0.4.5/user_docs/guides/working-with-k8s/vs_helm.md @@ -357,7 +357,7 @@ We can get the `Deployment` and `Service` resources throw the following command: + `Deployment` -```bash +```shell $ kcl workload-kcl/deployment.k -Y workload-kcl/kcl.yaml apiVersion: apps/v1 kind: Deployment @@ -394,7 +394,7 @@ spec: + `Service` -```bash +```shell $ kcl workload-kcl/service.k -Y workload-kcl/kcl.yaml apiVersion: v1 kind: Service @@ -418,7 +418,7 @@ spec: In addition, we can overwrite the value in the `kcl.yaml` file with the `-D` parameter, such as executing the following command. -```bash +```shell $ kcl workload-kcl/service.k -Y workload-kcl/kcl.yaml -D service=None apiVersion: v1 kind: Service diff --git a/versioned_docs/version-0.4.5/user_docs/guides/working-with-k8s/vs_kustomize.md b/versioned_docs/version-0.4.5/user_docs/guides/working-with-k8s/vs_kustomize.md index e245e93d..529f0650 100644 --- a/versioned_docs/version-0.4.5/user_docs/guides/working-with-k8s/vs_kustomize.md +++ b/versioned_docs/version-0.4.5/user_docs/guides/working-with-k8s/vs_kustomize.md @@ -104,7 +104,7 @@ The base directory stores the basic deployment configuration, and the prod envir We can display the real deployment configuration of the prod environment through the following command. -```bash +```shell $ kubectl kustomize ./prod apiVersion: apps/v1 kind: Deployment @@ -142,7 +142,7 @@ spec: We can also directly apply the configuration to the cluster through the following command. -```bash +```shell $ kubectl apply -k ./prod deployment.apps/ldap created @@ -237,7 +237,7 @@ diff prod-deployment.yaml deployment.yaml Of course, we can also use KCL tools together with kubectl and other tools to apply the configuration of the production environment to the cluster -```bash +```shell $ kcl main.k -D env=prod | kubectl apply -f - deployment.apps/ldap created @@ -245,7 +245,7 @@ deployment.apps/ldap created Finally, check the deployment status through kubectl -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/versioned_docs/version-0.4.6/reference/xlang-api/overview.md b/versioned_docs/version-0.4.6/reference/xlang-api/overview.md index e44eca5c..2f9047ef 100644 --- a/versioned_docs/version-0.4.6/reference/xlang-api/overview.md +++ b/versioned_docs/version-0.4.6/reference/xlang-api/overview.md @@ -139,7 +139,7 @@ x1 = Person { Execute the following command and get the output: -```bash +```shell $ python3 -m kclvm hello.k name: kcl age: 1 @@ -166,7 +166,7 @@ print(planner.plan(kclvm_exec.Run(["hello.k"]).filter_by_path_selector())) Execute the following command and get the output: -```bash +```shell $ python3 main.py name: kcl age: 1 diff --git a/versioned_docs/version-0.4.6/tools/cli/kcl/vet.md b/versioned_docs/version-0.4.6/tools/cli/kcl/vet.md index e68f6b36..851f87d1 100644 --- a/versioned_docs/version-0.4.6/tools/cli/kcl/vet.md +++ b/versioned_docs/version-0.4.6/tools/cli/kcl/vet.md @@ -49,7 +49,7 @@ schema Data: Execute the following command: -```bash +```shell $ kcl-vet data.json schema.k ``` @@ -57,13 +57,13 @@ $ kcl-vet data.json schema.k When multiple schema definitions exist in the KCL file, by default, the KCL Validation tool will use the first schema to check. If you need to specify a schema for verification, you can use the `-d|--schema` parameter -```bash +```shell $ kcl-vet data.json schema.k -d User ``` ## Args -```bash +```shell $ kcl-vet -h USAGE: kcl-vet [OPTIONS] [ARGS] diff --git a/versioned_docs/version-0.4.6/user_docs/guides/data-integration.md b/versioned_docs/version-0.4.6/user_docs/guides/data-integration.md index 154b2a92..3abb7f82 100644 --- a/versioned_docs/version-0.4.6/user_docs/guides/data-integration.md +++ b/versioned_docs/version-0.4.6/user_docs/guides/data-integration.md @@ -44,7 +44,7 @@ server_yaml = yaml.encode({ In the above code, we use the built-in `yaml` module of KCL and its `yaml.decode` function directly integrates YAML data, and uses the `Server` schema to directly verify the integrated YAML data. In addition, we can use `yaml.encode` to serialize YAML data. We can obtain the configuration output through the following command: -```bash +```shell $ kcl yaml.k server: ports: @@ -77,7 +77,7 @@ server_json = json.encode({ The output of the execution command is: -```bash +```shell $ kcl json.k server: ports: diff --git a/versioned_docs/version-0.4.6/user_docs/guides/schema-definition.md b/versioned_docs/version-0.4.6/user_docs/guides/schema-definition.md index a8839de4..287413d9 100644 --- a/versioned_docs/version-0.4.6/user_docs/guides/schema-definition.md +++ b/versioned_docs/version-0.4.6/user_docs/guides/schema-definition.md @@ -90,7 +90,7 @@ In the above file, we use the `schema` keyword to define three models `App`, `Se We can get the YAML output of the `app` instance by using the following command line -```bash +```shell $ kcl main.k app: domainType: Standard @@ -107,7 +107,7 @@ app: We can still get the YAML output of the `app` instance by using the following command line -```bash +```shell $ kcl main.k app: domainType: Standard diff --git a/versioned_docs/version-0.4.6/user_docs/guides/working-with-k8s/generate_k8s_manifests.md b/versioned_docs/version-0.4.6/user_docs/guides/working-with-k8s/generate_k8s_manifests.md index 02ff62c1..8e1bc49e 100644 --- a/versioned_docs/version-0.4.6/user_docs/guides/working-with-k8s/generate_k8s_manifests.md +++ b/versioned_docs/version-0.4.6/user_docs/guides/working-with-k8s/generate_k8s_manifests.md @@ -154,7 +154,7 @@ spec: Of course, we can use KCL together with kubectl and other tools. Let's execute the following commands and see the result: -```bash +```shell $ kcl main.k | kubectl apply -f - deployment.apps/nginx-deployment configured @@ -164,7 +164,7 @@ It can be seen from the command line that it is completely consistent with the d Check the deployment status through kubectl -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/versioned_docs/version-0.4.6/user_docs/guides/working-with-k8s/vs_helm.md b/versioned_docs/version-0.4.6/user_docs/guides/working-with-k8s/vs_helm.md index 0a3b1984..f8de8083 100644 --- a/versioned_docs/version-0.4.6/user_docs/guides/working-with-k8s/vs_helm.md +++ b/versioned_docs/version-0.4.6/user_docs/guides/working-with-k8s/vs_helm.md @@ -357,7 +357,7 @@ We can get the `Deployment` and `Service` resources throw the following command: + `Deployment` -```bash +```shell $ kcl workload-kcl/deployment.k -Y workload-kcl/kcl.yaml apiVersion: apps/v1 kind: Deployment @@ -394,7 +394,7 @@ spec: + `Service` -```bash +```shell $ kcl workload-kcl/service.k -Y workload-kcl/kcl.yaml apiVersion: v1 kind: Service @@ -418,7 +418,7 @@ spec: In addition, we can overwrite the value in the `kcl.yaml` file with the `-D` parameter, such as executing the following command. -```bash +```shell $ kcl workload-kcl/service.k -Y workload-kcl/kcl.yaml -D service=None apiVersion: v1 kind: Service diff --git a/versioned_docs/version-0.4.6/user_docs/guides/working-with-k8s/vs_kustomize.md b/versioned_docs/version-0.4.6/user_docs/guides/working-with-k8s/vs_kustomize.md index e245e93d..529f0650 100644 --- a/versioned_docs/version-0.4.6/user_docs/guides/working-with-k8s/vs_kustomize.md +++ b/versioned_docs/version-0.4.6/user_docs/guides/working-with-k8s/vs_kustomize.md @@ -104,7 +104,7 @@ The base directory stores the basic deployment configuration, and the prod envir We can display the real deployment configuration of the prod environment through the following command. -```bash +```shell $ kubectl kustomize ./prod apiVersion: apps/v1 kind: Deployment @@ -142,7 +142,7 @@ spec: We can also directly apply the configuration to the cluster through the following command. -```bash +```shell $ kubectl apply -k ./prod deployment.apps/ldap created @@ -237,7 +237,7 @@ diff prod-deployment.yaml deployment.yaml Of course, we can also use KCL tools together with kubectl and other tools to apply the configuration of the production environment to the cluster -```bash +```shell $ kcl main.k -D env=prod | kubectl apply -f - deployment.apps/ldap created @@ -245,7 +245,7 @@ deployment.apps/ldap created Finally, check the deployment status through kubectl -```bash +```shell $ kubectl get deploy NAME READY UP-TO-DATE AVAILABLE AGE diff --git a/versioned_docs/version-0.5.0/reference/package-management/command-reference/6.login.md b/versioned_docs/version-0.5.0/reference/package-management/command-reference/6.login.md index 228353cf..68ca0f1b 100644 --- a/versioned_docs/version-0.5.0/reference/package-management/command-reference/6.login.md +++ b/versioned_docs/version-0.5.0/reference/package-management/command-reference/6.login.md @@ -31,14 +31,24 @@ Show help for `kpm login` command. ### login to a registry with account and password ```shell -$ kpm login -u -p +kpm login -u -p +``` + +The output is + +```shell Login succeeded ``` ### login to a registry with account, and enter the password interactively ```shell -$ kpm login -u +kpm login -u +``` + +The output is + +```shell Password: Login succeeded ``` @@ -46,7 +56,12 @@ Login succeeded ### login to a registry, and enter the account and password interactively ```shell -$ kpm login +kpm login +``` + +The output is + +```shell Username: Password: Login succeeded diff --git a/versioned_docs/version-0.5.0/reference/xlang-api/overview.md b/versioned_docs/version-0.5.0/reference/xlang-api/overview.md index 605fc899..65b8e679 100644 --- a/versioned_docs/version-0.5.0/reference/xlang-api/overview.md +++ b/versioned_docs/version-0.5.0/reference/xlang-api/overview.md @@ -135,7 +135,7 @@ x1 = Person { Execute the following command and get the output: -```bash +```shell $ python3 -m kclvm hello.k name: kcl age: 1 @@ -162,7 +162,7 @@ print(planner.plan(kclvm_exec.Run(["hello.k"]).filter_by_path_selector())) Execute the following command and get the output: -```bash +```shell $ python3 main.py name: kcl age: 1 diff --git a/versioned_docs/version-0.5.0/tools/cli/kcl/vet.md b/versioned_docs/version-0.5.0/tools/cli/kcl/vet.md index e68f6b36..e17f8bf3 100644 --- a/versioned_docs/version-0.5.0/tools/cli/kcl/vet.md +++ b/versioned_docs/version-0.5.0/tools/cli/kcl/vet.md @@ -49,21 +49,21 @@ schema Data: Execute the following command: -```bash -$ kcl-vet data.json schema.k +```shell +kcl-vet data.json schema.k ``` ## Specify the schema for validation When multiple schema definitions exist in the KCL file, by default, the KCL Validation tool will use the first schema to check. If you need to specify a schema for verification, you can use the `-d|--schema` parameter -```bash -$ kcl-vet data.json schema.k -d User +```shell +kcl-vet data.json schema.k -d User ``` ## Args -```bash +```shell $ kcl-vet -h USAGE: kcl-vet [OPTIONS] [ARGS] diff --git a/versioned_docs/version-0.5.0/user_docs/getting-started/kcl-quick-start.md b/versioned_docs/version-0.5.0/user_docs/getting-started/kcl-quick-start.md index b233b98d..807ac893 100644 --- a/versioned_docs/version-0.5.0/user_docs/getting-started/kcl-quick-start.md +++ b/versioned_docs/version-0.5.0/user_docs/getting-started/kcl-quick-start.md @@ -21,7 +21,13 @@ Set the `hello` attribute to the `"KCL"` string. Then save the code to the `hell How to execute this program depends on the specific development environment, we first assume that the local macOS or Linux system has installed the `kcl` command (or enter the **Docker** environment test by `docker run --rm -it kcllang/kcl`) and then run the following command: ```shell -$ kcl hello.k +kcl hello.k +``` + +The output is + + +```yaml hello: KCL ``` @@ -123,7 +129,12 @@ database = DatabaseConfig { When executed, an error similar to the following will be generated (the displayed file path depends on the local environment): ```shell -$ kcl server.k +kcl server.k +``` + +The output is + +```shell error[E2G22]: TypeError --> /path/to/server.k:8:5 | diff --git a/versioned_docs/version-0.5.0/user_docs/guides/abstraction.md b/versioned_docs/version-0.5.0/user_docs/guides/abstraction.md index e134c679..a2053556 100644 --- a/versioned_docs/version-0.5.0/user_docs/guides/abstraction.md +++ b/versioned_docs/version-0.5.0/user_docs/guides/abstraction.md @@ -73,7 +73,12 @@ Besides, KCL allows developers to define the resources required for their applic If we want to transform the application config into the docker compose config, we can run the command simply: ```shell -$ kcl main.k docker_compose_render.k +kcl main.k docker_compose_render.k +``` + +The output is + +```yaml services: app: image: ngnix @@ -88,7 +93,12 @@ services: If we want to transform the application config into the Kubernetes manifests, we can run the command simply: ```shell -$ kcl main.k kubernetes_render.k +kcl main.k kubernetes_render.k +``` + +The output is + +```yaml apiVersion: apps/v1 kind: Deployment metadata: diff --git a/versioned_docs/version-0.5.0/user_docs/guides/ci-integration/2-gitlab-ci.md b/versioned_docs/version-0.5.0/user_docs/guides/ci-integration/2-gitlab-ci.md index 96fa0a3d..de4f5ce5 100644 --- a/versioned_docs/version-0.5.0/user_docs/guides/ci-integration/2-gitlab-ci.md +++ b/versioned_docs/version-0.5.0/user_docs/guides/ci-integration/2-gitlab-ci.md @@ -21,6 +21,8 @@ The overall workflow is as follows: We put the application source code and infrastructure deployment code in different repos, which can be maintained by different roles to achieve the separation of concerns. +### 1. Get the Example + + Get the application code ```shell @@ -28,8 +30,6 @@ git clone https://gitlab.com/kcl-lang/flask-demo.git/ cd flask-demo ``` -## Summary - This is a web application written in Python. We can use the `Dockerfile` in the application directory to generate a container image of this application, and also use Gitlab CI to automatically build a image named `flask_demo`, the CI configuration is as follows ```yaml diff --git a/versioned_docs/version-0.5.0/user_docs/guides/data-integration.md b/versioned_docs/version-0.5.0/user_docs/guides/data-integration.md index 154b2a92..fa35de9e 100644 --- a/versioned_docs/version-0.5.0/user_docs/guides/data-integration.md +++ b/versioned_docs/version-0.5.0/user_docs/guides/data-integration.md @@ -44,8 +44,13 @@ server_yaml = yaml.encode({ In the above code, we use the built-in `yaml` module of KCL and its `yaml.decode` function directly integrates YAML data, and uses the `Server` schema to directly verify the integrated YAML data. In addition, we can use `yaml.encode` to serialize YAML data. We can obtain the configuration output through the following command: -```bash -$ kcl yaml.k +```shell +kcl yaml.k +``` + +The output is + +```yaml server: ports: - 80 @@ -77,8 +82,11 @@ server_json = json.encode({ The output of the execution command is: -```bash -$ kcl json.k +```shell +kcl json.k +``` + +```yaml server: ports: - 80 diff --git a/versioned_docs/version-0.5.0/user_docs/guides/schema-definition.md b/versioned_docs/version-0.5.0/user_docs/guides/schema-definition.md index a8839de4..e802276f 100644 --- a/versioned_docs/version-0.5.0/user_docs/guides/schema-definition.md +++ b/versioned_docs/version-0.5.0/user_docs/guides/schema-definition.md @@ -90,8 +90,13 @@ In the above file, we use the `schema` keyword to define three models `App`, `Se We can get the YAML output of the `app` instance by using the following command line -```bash -$ kcl main.k +```shell +kcl main.k +``` + +The output is + +```yaml app: domainType: Standard containerPort: 80 @@ -107,8 +112,13 @@ app: We can still get the YAML output of the `app` instance by using the following command line -```bash -$ kcl main.k +```shell +kcl main.k +``` + +The output is + +```yaml app: domainType: Standard containerPort: 80 diff --git a/versioned_docs/version-0.5.0/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md b/versioned_docs/version-0.5.0/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md index 89f9dada..b517a3b0 100644 --- a/versioned_docs/version-0.5.0/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md +++ b/versioned_docs/version-0.5.0/user_docs/guides/working-with-k8s/2-generate-k8s-manifests.md @@ -120,9 +120,13 @@ spec: Of course, we can use KCL together with kubectl and other tools. Let's execute the following commands and see the result: -```bash -$ kcl main.k | kubectl apply -f - +```shell +kcl main.k | kubectl apply -f - +``` + +The output is +```shell deployment.apps/nginx-deployment configured ``` @@ -130,9 +134,13 @@ It can be seen from the command line that it is completely consistent with the d Check the deployment status through kubectl -```bash -$ kubectl get deploy +```shell +kubectl get deploy +``` + +The output is +```shell NAME READY UP-TO-DATE AVAILABLE AGE nginx-deployment 3/3 3 3 15s ```