diff --git a/docs/community/contribute/git-guideline.md b/docs/community/contribute/git-guideline.md index 7d427c01..9bebc635 100644 --- a/docs/community/contribute/git-guideline.md +++ b/docs/community/contribute/git-guideline.md @@ -32,7 +32,7 @@ The branch name mainly includes two fields, which are separated by "-". Includin For example, Alice first transfers the Fork warehouse to his own account, and then creates a branch with the corresponding name 'alice: fix output fmt bug' (Alice's account is before the colon) to fix the output formatting bug. -## 3. 关于 Git Commit +## 3. About Git Commit We refer to [Commitizen](https://github.com/commitizen/cz-cli) to write a Commit Message. diff --git a/docs/community/release-policy/kcl.md b/docs/community/release-policy/kcl.md index 5772bf49..3298ecc3 100644 --- a/docs/community/release-policy/kcl.md +++ b/docs/community/release-policy/kcl.md @@ -14,7 +14,7 @@ The KCL project version release strategy is as follows: ## Release Process and Rules - Feature Development: Main branch development, branch releases, block user issues, critical bugs, security vulnerabilities, and high-priority fixes. It is given higher priority over general feature development and should be completed within a week. -Iteration Cycle: The iteration cycle is typically 3 months, with a new minor version released every 3 months. +- Iteration Cycle: The iteration cycle is typically 3 months, with a new minor version released every 3 months. - Version Planning: Two weeks before the release, an alpha version is produced, followed by a beta version one week before the release. Alpha versions can still include feature merging, while beta versions only include bug fixes. The final release version is tagged as a long-term saved release branch. - Release Plan: A detailed release plan (Github Milestone) is created at the beginning of each release cycle, including release dates, version numbers, feature lists, and testing plans. The release plan should be followed as closely as possible to ensure timely releases. - Pre-release Testing: Comprehensive testing, including unit testing, integration testing, fuzz testing, stress testing, and user acceptance testing, is conducted before releasing a new version. The new version is only released when it passes all tests without any issues. diff --git a/docs/reference/xlang-api/go-api.md b/docs/reference/xlang-api/go-api.md index cdbc09f2..b82b0fd5 100644 --- a/docs/reference/xlang-api/go-api.md +++ b/docs/reference/xlang-api/go-api.md @@ -95,50 +95,49 @@ x1 = Person { ## Index - [Go API](#go-api) - - [KCL Go SDK](#kcl-go-sdk) - - [Index](#index) - - [Constants](#constants) - - [func FormatCode](#func-formatcode) - - [func FormatPath](#func-formatpath) - - [func GetSchemaTypeMapping](#func-getschematypemapping) - - [func InitKclvmPath](#func-initkclvmpath) - - [func InitKclvmRuntime](#func-initkclvmruntime) - - [func LintPath](#func-lintpath) - - [func ListDepFiles](#func-listdepfiles) - - [func ListDownStreamFiles](#func-listdownstreamfiles) - - [func ListUpStreamFiles](#func-listupstreamfiles) - - [func OverrideFile](#func-overridefile) - - [func Validate](#func-validate) - - [func ValidateCode](#func-validatecode) - - [type KCLResult](#type-kclresult) - - [type KCLResultList](#type-kclresultlist) - - [func MustRun](#func-mustrun) - - [func Run](#func-run) - - [func RunFiles](#func-runfiles) - - [type KclType](#type-kcltype) - - [func GetSchemaType](#func-getschematype) - - [type ListDepFilesOption](#type-listdepfilesoption) - - [type ListDepsOptions](#type-listdepsoptions) - - [type Option](#type-option) - - [func WithCode](#func-withcode) - - [func WithDisableNone](#func-withdisablenone) - - [func WithExternalPkgs](#func-withexternalpkgs) - - [func WithIncludeSchemaTypePath](#func-withincludeschematypepath) - - [func WithKFilenames](#func-withkfilenames) - - [func WithLogger](#func-withlogger) - - [func WithOptions](#func-withoptions) - - [func WithOverrides](#func-withoverrides) - - [func WithPrintOverridesAST](#func-withprintoverridesast) - - [func WithSelectors](#func-withselectors) - - [func WithSettings](#func-withsettings) - - [func WithSortKeys](#func-withsortkeys) - - [func WithWorkDir](#func-withworkdir) - - [type TestCaseInfo](#type-testcaseinfo) - - [type TestOptions](#type-testoptions) - - [type TestResult](#type-testresult) - - [func Test](#func-test) - - [type ValidateOptions](#type-validateoptions) - + - [KCL Go SDK](#kcl-go-sdk) + - [Index](#index) + - [Constants](#constants) + - [func FormatCode](#func-formatcode) + - [func FormatPath](#func-formatpath) + - [func GetSchemaTypeMapping](#func-getschematypemapping) + - [func InitKclvmPath](#func-initkclvmpath) + - [func InitKclvmRuntime](#func-initkclvmruntime) + - [func LintPath](#func-lintpath) + - [func ListDepFiles](#func-listdepfiles) + - [func ListDownStreamFiles](#func-listdownstreamfiles) + - [func ListUpStreamFiles](#func-listupstreamfiles) + - [func OverrideFile](#func-overridefile) + - [func Validate](#func-validate) + - [func ValidateCode](#func-validatecode) + - [type KCLResult](#type-kclresult) + - [type KCLResultList](#type-kclresultlist) + - [func MustRun](#func-mustrun) + - [func Run](#func-run) + - [func RunFiles](#func-runfiles) + - [type KclType](#type-kcltype) + - [func GetSchemaType](#func-getschematype) + - [type ListDepFilesOption](#type-listdepfilesoption) + - [type ListDepsOptions](#type-listdepsoptions) + - [type Option](#type-option) + - [func WithCode](#func-withcode) + - [func WithDisableNone](#func-withdisablenone) + - [func WithExternalPkgs](#func-withexternalpkgs) + - [func WithIncludeSchemaTypePath](#func-withincludeschematypepath) + - [func WithKFilenames](#func-withkfilenames) + - [func WithLogger](#func-withlogger) + - [func WithOptions](#func-withoptions) + - [func WithOverrides](#func-withoverrides) + - [func WithPrintOverridesAST](#func-withprintoverridesast) + - [func WithSelectors](#func-withselectors) + - [func WithSettings](#func-withsettings) + - [func WithSortKeys](#func-withsortkeys) + - [func WithWorkDir](#func-withworkdir) + - [type TestCaseInfo](#type-testcaseinfo) + - [type TestOptions](#type-testoptions) + - [type TestResult](#type-testresult) + - [func Test](#func-test) + - [type ValidateOptions](#type-validateoptions) ## Constants @@ -148,7 +147,7 @@ KclvmAbiVersion is the current kclvm ABI version. const KclvmAbiVersion = scripts.KclvmAbiVersion ``` -## func [FormatCode]() +## func [FormatCode](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L133) ```go func FormatCode(code interface{}) ([]byte, error) @@ -159,8 +158,6 @@ FormatCode returns the formatted code.
Example

- - ```go package main @@ -181,8 +178,6 @@ func main() { } ``` - - ``` a = 1 + 2 ``` @@ -190,7 +185,7 @@ a = 1 + 2

-## func [FormatPath]() +## func [FormatPath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L145) ```go func FormatPath(path string) (changedPaths []string, err error) @@ -203,8 +198,6 @@ the returned changedPaths are the changed file paths \(relative path\)
Example

- - ```go package main @@ -227,7 +220,7 @@ func main() {

-## func [GetSchemaTypeMapping]() +## func [GetSchemaTypeMapping](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L227) ```go func GetSchemaTypeMapping(file, code, schemaName string) (map[string]*KclType, error) @@ -247,13 +240,13 @@ code: string The kcl code string ``` -schema\_name: string +schema_name: string ``` The schema name got, when the schema name is empty, all schemas are returned. ``` -## func [InitKclvmPath]() +## func [InitKclvmPath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L61) ```go func InitKclvmPath(kclvmRoot string) @@ -261,7 +254,7 @@ func InitKclvmPath(kclvmRoot string) InitKclvmPath init kclvm path. -## func [InitKclvmRuntime]() +## func [InitKclvmRuntime](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L66) ```go func InitKclvmRuntime(n int) @@ -269,7 +262,7 @@ func InitKclvmRuntime(n int) InitKclvmRuntime init kclvm process. -## func [LintPath]() +## func [LintPath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L165) ```go func LintPath(paths []string) (results []string, err error) @@ -314,7 +307,7 @@ Module 'a' imported but unused

-## func [ListDepFiles]() +## func [ListDepFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L150) ```go func ListDepFiles(workDir string, opt *ListDepFilesOption) (files []string, err error) @@ -322,7 +315,7 @@ func ListDepFiles(workDir string, opt *ListDepFilesOption) (files []string, err ListDepFiles return the depend files from the given path -## func [ListDownStreamFiles]() +## func [ListDownStreamFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L160) ```go func ListDownStreamFiles(workDir string, opt *ListDepsOptions) ([]string, error) @@ -330,7 +323,7 @@ func ListDownStreamFiles(workDir string, opt *ListDepsOptions) ([]string, error) ListDownStreamFiles return a list of downstream depend files from the given changed path list. -## func [ListUpStreamFiles]() +## func [ListUpStreamFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L155) ```go func ListUpStreamFiles(workDir string, opt *ListDepsOptions) (deps []string, err error) @@ -338,7 +331,7 @@ func ListUpStreamFiles(workDir string, opt *ListDepsOptions) (deps []string, err ListUpStreamFiles return a list of upstream depend files from the given path list -## func [OverrideFile]() +## func [OverrideFile](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L177) ```go func OverrideFile(file string, specs, importPaths []string) (bool, error) @@ -353,7 +346,7 @@ When the pkgpath is '__main__', it can be omitted. importPaths. List of import statements that need to be added -## func [Validate]() +## func [Validate](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L188) ```go func Validate(dataFile, schemaFile string, opts *ValidateOptions) (ok bool, err error) @@ -361,7 +354,7 @@ func Validate(dataFile, schemaFile string, opts *ValidateOptions) (ok bool, err Validate validates the given data file against the specified schema file with the provided options. -## func [ValidateCode]() +## func [ValidateCode](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L182) ```go func ValidateCode(data, code string, opts *ValidateOptions) (ok bool, err error) @@ -369,8 +362,7 @@ func ValidateCode(data, code string, opts *ValidateOptions) (ok bool, err error) ValidateCode validate data string match code string -## type [KCLResult]() - +## type [KCLResult](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L54) ```go type KCLResult = kcl.KCLResult @@ -392,9 +384,9 @@ func main() { const k_code = ` name = "kcl" age = 1 - + two = 2 - + schema Person: name: str = "kcl" age: int = 1 @@ -464,13 +456,13 @@ person: {Name:kcl Age:101}

-## type [KCLResultList]() +## type [KCLResultList](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L55) ```go type KCLResultList = kcl.KCLResultList ``` -### func [MustRun]() +### func [MustRun](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L71) ```go func MustRun(path string, opts ...Option) *KCLResultList @@ -579,8 +571,6 @@ x = Person()
Example (Settings)

- - ```go package main @@ -599,7 +589,7 @@ func main() {

-### func [Run]() +### func [Run](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L76) ```go func Run(path string, opts ...Option) (*KCLResultList, error) @@ -610,8 +600,6 @@ Run evaluates the KCL program with path and opts, then returns the object list.
Example (Get Field)

- - ```go package main @@ -647,7 +635,7 @@ R000A

-### func [RunFiles]() +### func [RunFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L81) ```go func RunFiles(paths []string, opts ...Option) (*KCLResultList, error) @@ -676,13 +664,13 @@ func main() {

-## type [KclType]() +## type [KclType](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L57) ```go type KclType = kcl.KclType ``` -### func [GetSchemaType]() +### func [GetSchemaType](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L210) ```go func GetSchemaType(file, code, schemaName string) ([]*KclType, error) @@ -702,31 +690,31 @@ code: string The kcl code string ``` -schema\_name: string +schema_name: string ``` The schema name got, when the schema name is empty, all schemas are returned. ``` -## type [ListDepFilesOption]() +## type [ListDepFilesOption](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L49) ```go type ListDepFilesOption = list.Option ``` -## type [ListDepsOptions]() +## type [ListDepsOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L48) ```go type ListDepsOptions = list.DepOptions ``` -## type [Option]() +## type [Option](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L47) ```go type Option = kcl.Option ``` -### func [WithCode]() +### func [WithCode](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L86) ```go func WithCode(codes ...string) Option @@ -734,7 +722,7 @@ func WithCode(codes ...string) Option WithCode returns a Option which hold a kcl source code list. -### func [WithDisableNone]() +### func [WithDisableNone](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L110) ```go func WithDisableNone(disableNone bool) Option @@ -742,7 +730,7 @@ func WithDisableNone(disableNone bool) Option WithDisableNone returns a Option which hold a disable none switch. -### func [WithExternalPkgs]() +### func [WithExternalPkgs](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L89) ```go func WithExternalPkgs(externalPkgs ...string) Option @@ -750,7 +738,7 @@ func WithExternalPkgs(externalPkgs ...string) Option WithExternalPkgs returns a Option which hold a external package list. -### func [WithIncludeSchemaTypePath]() +### func [WithIncludeSchemaTypePath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L113) ```go func WithIncludeSchemaTypePath(includeSchemaTypePath bool) Option @@ -758,7 +746,7 @@ func WithIncludeSchemaTypePath(includeSchemaTypePath bool) Option WithIncludeSchemaTypePath returns a Option which hold a include schema type path switch. -### func [WithKFilenames]() +### func [WithKFilenames](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L92) ```go func WithKFilenames(filenames ...string) Option @@ -766,7 +754,7 @@ func WithKFilenames(filenames ...string) Option WithKFilenames returns a Option which hold a filenames list. -### func [WithLogger]() +### func [WithLogger](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L128) ```go func WithLogger(l io.Writer) Option @@ -774,7 +762,7 @@ func WithLogger(l io.Writer) Option WithLogger returns a Option which hold a logger. -### func [WithOptions]() +### func [WithOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L95) ```go func WithOptions(key_value_list ...string) Option @@ -785,8 +773,6 @@ WithOptions returns a Option which hold a key=value pair list for option functio
Example

- - ```go package main @@ -822,7 +808,7 @@ name: kcl

-### func [WithOverrides]() +### func [WithOverrides](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L98) ```go func WithOverrides(override_list ...string) Option @@ -830,7 +816,7 @@ func WithOverrides(override_list ...string) Option WithOverrides returns a Option which hold a override list. -### func [WithPrintOverridesAST]() +### func [WithPrintOverridesAST](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L118) ```go func WithPrintOverridesAST(printOverridesAST bool) Option @@ -838,7 +824,7 @@ func WithPrintOverridesAST(printOverridesAST bool) Option WithPrintOverridesAST returns a Option which hold a printOverridesAST switch. -### func [WithSelectors]() +### func [WithSelectors](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L101) ```go func WithSelectors(selectors ...string) Option @@ -846,7 +832,7 @@ func WithSelectors(selectors ...string) Option WithSelectors returns a Option which hold a path selector list. -### func [WithSettings]() +### func [WithSettings](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L104) ```go func WithSettings(filename string) Option @@ -854,7 +840,7 @@ func WithSettings(filename string) Option WithSettings returns a Option which hold a settings file. -### func [WithSortKeys]() +### func [WithSortKeys](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L123) ```go func WithSortKeys(sortKeys bool) Option @@ -862,7 +848,7 @@ func WithSortKeys(sortKeys bool) Option WithSortKeys returns a Option which hold a sortKeys switch. -### func [WithWorkDir]() +### func [WithWorkDir](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L107) ```go func WithWorkDir(workDir string) Option @@ -870,29 +856,25 @@ func WithWorkDir(workDir string) Option WithWorkDir returns a Option which hold a work dir. -## type [TestCaseInfo]() +## type [TestCaseInfo](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L52) ```go type TestCaseInfo = testing.TestCaseInfo ``` -## type [TestOptions]() - - +## type [TestOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L51) ```go type TestOptions = testing.TestOptions ``` -## type [TestResult]() - - +## type [TestResult](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L53) ```go type TestResult = testing.TestResult ``` -### func [Test]() +### func [Test](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L193) ```go func Test(testOpts *TestOptions, opts ...Option) (TestResult, error) @@ -900,9 +882,7 @@ func Test(testOpts *TestOptions, opts ...Option) (TestResult, error) Test calls the test tool to run uni tests in packages. -## type [ValidateOptions]() - - +## type [ValidateOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L50) ```go type ValidateOptions = validate.ValidateOptions diff --git a/docs/reference/xlang-api/rest-api.md b/docs/reference/xlang-api/rest-api.md index 17966c5a..483b8973 100644 --- a/docs/reference/xlang-api/rest-api.md +++ b/docs/reference/xlang-api/rest-api.md @@ -244,7 +244,7 @@ message ExecProgram_Args { repeated string k_filename_list = 2; repeated string k_code_list = 3; - + repeated CmdArgSpec args = 4; repeated CmdOverrideSpec overrides = 5; @@ -275,7 +275,7 @@ message ExecProgram_Args { // Whether only compiling the program bool compile_only = 15; - // Compile the dir recursively + // Compile the dir recursively bool recursive = 16; // -S --path_selector diff --git a/docs/tools/cli/kcl/docgen.md b/docs/tools/cli/kcl/docgen.md index 8fd72421..59a1abc5 100644 --- a/docs/tools/cli/kcl/docgen.md +++ b/docs/tools/cli/kcl/docgen.md @@ -58,8 +58,8 @@ Generate Markdown document for current package with a `kcl.mod` file. ```shell kcl doc generate -``` - +``` + Generate HTML document for current package ```shell @@ -106,7 +106,7 @@ Aliases: Examples: # Generate document for current package kcl doc generate - + Available Commands: generate Generates documents from code and examples diff --git a/docs/tools/cli/kcl/import.md b/docs/tools/cli/kcl/import.md index a8873190..fd30a719 100644 --- a/docs/tools/cli/kcl/import.md +++ b/docs/tools/cli/kcl/import.md @@ -2,7 +2,7 @@ sidebar_position: 4 --- -# Import +# Import ## Introduction diff --git a/docs/tools/cli/kcl/lint.md b/docs/tools/cli/kcl/lint.md index 2434b634..bf628240 100644 --- a/docs/tools/cli/kcl/lint.md +++ b/docs/tools/cli/kcl/lint.md @@ -51,13 +51,13 @@ Examples: # Lint multiple files kcl lint path/to/kcl1.k path/to/kcl2.k - + # Lint OCI packages kcl lint oci://ghcr.io/kcl-lang/hello-world - + # Lint the current package kcl lint - + Flags: -D, --argument strings Specify the top-level argument diff --git a/docs/tools/cli/kcl/overview.md b/docs/tools/cli/kcl/overview.md index 2406c437..08bf7634 100644 --- a/docs/tools/cli/kcl/overview.md +++ b/docs/tools/cli/kcl/overview.md @@ -51,7 +51,7 @@ Flags: -v, --version version for kcl Additional help topics: - kcl + kcl Use "kcl [command] --help" for more information about a command. ``` diff --git a/docs/tools/cli/kcl/run.md b/docs/tools/cli/kcl/run.md index de9f0436..b5b6c883 100644 --- a/docs/tools/cli/kcl/run.md +++ b/docs/tools/cli/kcl/run.md @@ -24,13 +24,13 @@ Examples: # Run multiple files kcl run path/to/kcl1.k path/to/kcl2.k - + # Run OCI packages kcl run oci://ghcr.io/kcl-lang/hello-world - + # Run the current package kcl run - + Flags: -D, --argument strings Specify the top-level argument diff --git a/docs/tools/cli/kcl/test.md b/docs/tools/cli/kcl/test.md index 6c310aa3..18f5a9d0 100644 --- a/docs/tools/cli/kcl/test.md +++ b/docs/tools/cli/kcl/test.md @@ -91,7 +91,7 @@ EvaluationError --> hello_test.k:3:1 | 3 | assert a.name == 'kcl2' - | + | | @@ -100,7 +100,7 @@ EvaluationError --> hello_test.k:7:1 | 7 | assert a.age == 123 - | + | | @@ -109,7 +109,7 @@ EvaluationError --> hello_test.k:11:1 | 11 | assert a.name == "kcl2" - | + | | @@ -148,7 +148,7 @@ Examples: # Test with the regex expression filter 'test_func' kcl test ./... --run test_func - + Flags: --fail-fast Exist when meet the first fail test case in the test process. diff --git a/docs/tools/cli/openapi/crd-to-kcl.md b/docs/tools/cli/openapi/crd-to-kcl.md index d1c05e24..d07ed58b 100644 --- a/docs/tools/cli/openapi/crd-to-kcl.md +++ b/docs/tools/cli/openapi/crd-to-kcl.md @@ -3,7 +3,7 @@ To convert from models defined in the Kubernetes CRD file to KCL schema, we could run the following script: ```shell -kcl import -m crd -o ${the_kcl_files_output_dir} -s ${your_CRD.yaml} +kcl import -m crd -o ${the_kcl_files_output_dir} -s ${your_CRD.yaml} ``` ## Example @@ -58,7 +58,7 @@ spec: - The script will be: ```shell -kcl import -m crd -o ~/ -s test_crontab_CRD.yaml +kcl import -m crd -o ~/ -s test_crontab_CRD.yaml ``` - Then we can find the generated file here: `~/models/stable_example_com_v1_cron_tab.k` diff --git a/docs/tools/cli/openapi/openapi-to-kcl.md b/docs/tools/cli/openapi/openapi-to-kcl.md index 316f892c..997dc792 100644 --- a/docs/tools/cli/openapi/openapi-to-kcl.md +++ b/docs/tools/cli/openapi/openapi-to-kcl.md @@ -35,7 +35,7 @@ paths: {} - The script will be: ```shell -kcl import -m openapi -o ~/ -s test_open_api_spec.yaml +kcl import -m openapi -o ~/ -s test_open_api_spec.yaml ``` - Then we can find the generated file here: `~/models/v1/test_int.k` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/xlang-api/go-api.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/xlang-api/go-api.md index cdbc09f2..b82b0fd5 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/xlang-api/go-api.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/reference/xlang-api/go-api.md @@ -95,50 +95,49 @@ x1 = Person { ## Index - [Go API](#go-api) - - [KCL Go SDK](#kcl-go-sdk) - - [Index](#index) - - [Constants](#constants) - - [func FormatCode](#func-formatcode) - - [func FormatPath](#func-formatpath) - - [func GetSchemaTypeMapping](#func-getschematypemapping) - - [func InitKclvmPath](#func-initkclvmpath) - - [func InitKclvmRuntime](#func-initkclvmruntime) - - [func LintPath](#func-lintpath) - - [func ListDepFiles](#func-listdepfiles) - - [func ListDownStreamFiles](#func-listdownstreamfiles) - - [func ListUpStreamFiles](#func-listupstreamfiles) - - [func OverrideFile](#func-overridefile) - - [func Validate](#func-validate) - - [func ValidateCode](#func-validatecode) - - [type KCLResult](#type-kclresult) - - [type KCLResultList](#type-kclresultlist) - - [func MustRun](#func-mustrun) - - [func Run](#func-run) - - [func RunFiles](#func-runfiles) - - [type KclType](#type-kcltype) - - [func GetSchemaType](#func-getschematype) - - [type ListDepFilesOption](#type-listdepfilesoption) - - [type ListDepsOptions](#type-listdepsoptions) - - [type Option](#type-option) - - [func WithCode](#func-withcode) - - [func WithDisableNone](#func-withdisablenone) - - [func WithExternalPkgs](#func-withexternalpkgs) - - [func WithIncludeSchemaTypePath](#func-withincludeschematypepath) - - [func WithKFilenames](#func-withkfilenames) - - [func WithLogger](#func-withlogger) - - [func WithOptions](#func-withoptions) - - [func WithOverrides](#func-withoverrides) - - [func WithPrintOverridesAST](#func-withprintoverridesast) - - [func WithSelectors](#func-withselectors) - - [func WithSettings](#func-withsettings) - - [func WithSortKeys](#func-withsortkeys) - - [func WithWorkDir](#func-withworkdir) - - [type TestCaseInfo](#type-testcaseinfo) - - [type TestOptions](#type-testoptions) - - [type TestResult](#type-testresult) - - [func Test](#func-test) - - [type ValidateOptions](#type-validateoptions) - + - [KCL Go SDK](#kcl-go-sdk) + - [Index](#index) + - [Constants](#constants) + - [func FormatCode](#func-formatcode) + - [func FormatPath](#func-formatpath) + - [func GetSchemaTypeMapping](#func-getschematypemapping) + - [func InitKclvmPath](#func-initkclvmpath) + - [func InitKclvmRuntime](#func-initkclvmruntime) + - [func LintPath](#func-lintpath) + - [func ListDepFiles](#func-listdepfiles) + - [func ListDownStreamFiles](#func-listdownstreamfiles) + - [func ListUpStreamFiles](#func-listupstreamfiles) + - [func OverrideFile](#func-overridefile) + - [func Validate](#func-validate) + - [func ValidateCode](#func-validatecode) + - [type KCLResult](#type-kclresult) + - [type KCLResultList](#type-kclresultlist) + - [func MustRun](#func-mustrun) + - [func Run](#func-run) + - [func RunFiles](#func-runfiles) + - [type KclType](#type-kcltype) + - [func GetSchemaType](#func-getschematype) + - [type ListDepFilesOption](#type-listdepfilesoption) + - [type ListDepsOptions](#type-listdepsoptions) + - [type Option](#type-option) + - [func WithCode](#func-withcode) + - [func WithDisableNone](#func-withdisablenone) + - [func WithExternalPkgs](#func-withexternalpkgs) + - [func WithIncludeSchemaTypePath](#func-withincludeschematypepath) + - [func WithKFilenames](#func-withkfilenames) + - [func WithLogger](#func-withlogger) + - [func WithOptions](#func-withoptions) + - [func WithOverrides](#func-withoverrides) + - [func WithPrintOverridesAST](#func-withprintoverridesast) + - [func WithSelectors](#func-withselectors) + - [func WithSettings](#func-withsettings) + - [func WithSortKeys](#func-withsortkeys) + - [func WithWorkDir](#func-withworkdir) + - [type TestCaseInfo](#type-testcaseinfo) + - [type TestOptions](#type-testoptions) + - [type TestResult](#type-testresult) + - [func Test](#func-test) + - [type ValidateOptions](#type-validateoptions) ## Constants @@ -148,7 +147,7 @@ KclvmAbiVersion is the current kclvm ABI version. const KclvmAbiVersion = scripts.KclvmAbiVersion ``` -## func [FormatCode]() +## func [FormatCode](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L133) ```go func FormatCode(code interface{}) ([]byte, error) @@ -159,8 +158,6 @@ FormatCode returns the formatted code.
Example

- - ```go package main @@ -181,8 +178,6 @@ func main() { } ``` - - ``` a = 1 + 2 ``` @@ -190,7 +185,7 @@ a = 1 + 2

-## func [FormatPath]() +## func [FormatPath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L145) ```go func FormatPath(path string) (changedPaths []string, err error) @@ -203,8 +198,6 @@ the returned changedPaths are the changed file paths \(relative path\)
Example

- - ```go package main @@ -227,7 +220,7 @@ func main() {

-## func [GetSchemaTypeMapping]() +## func [GetSchemaTypeMapping](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L227) ```go func GetSchemaTypeMapping(file, code, schemaName string) (map[string]*KclType, error) @@ -247,13 +240,13 @@ code: string The kcl code string ``` -schema\_name: string +schema_name: string ``` The schema name got, when the schema name is empty, all schemas are returned. ``` -## func [InitKclvmPath]() +## func [InitKclvmPath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L61) ```go func InitKclvmPath(kclvmRoot string) @@ -261,7 +254,7 @@ func InitKclvmPath(kclvmRoot string) InitKclvmPath init kclvm path. -## func [InitKclvmRuntime]() +## func [InitKclvmRuntime](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L66) ```go func InitKclvmRuntime(n int) @@ -269,7 +262,7 @@ func InitKclvmRuntime(n int) InitKclvmRuntime init kclvm process. -## func [LintPath]() +## func [LintPath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L165) ```go func LintPath(paths []string) (results []string, err error) @@ -314,7 +307,7 @@ Module 'a' imported but unused

-## func [ListDepFiles]() +## func [ListDepFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L150) ```go func ListDepFiles(workDir string, opt *ListDepFilesOption) (files []string, err error) @@ -322,7 +315,7 @@ func ListDepFiles(workDir string, opt *ListDepFilesOption) (files []string, err ListDepFiles return the depend files from the given path -## func [ListDownStreamFiles]() +## func [ListDownStreamFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L160) ```go func ListDownStreamFiles(workDir string, opt *ListDepsOptions) ([]string, error) @@ -330,7 +323,7 @@ func ListDownStreamFiles(workDir string, opt *ListDepsOptions) ([]string, error) ListDownStreamFiles return a list of downstream depend files from the given changed path list. -## func [ListUpStreamFiles]() +## func [ListUpStreamFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L155) ```go func ListUpStreamFiles(workDir string, opt *ListDepsOptions) (deps []string, err error) @@ -338,7 +331,7 @@ func ListUpStreamFiles(workDir string, opt *ListDepsOptions) (deps []string, err ListUpStreamFiles return a list of upstream depend files from the given path list -## func [OverrideFile]() +## func [OverrideFile](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L177) ```go func OverrideFile(file string, specs, importPaths []string) (bool, error) @@ -353,7 +346,7 @@ When the pkgpath is '__main__', it can be omitted. importPaths. List of import statements that need to be added -## func [Validate]() +## func [Validate](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L188) ```go func Validate(dataFile, schemaFile string, opts *ValidateOptions) (ok bool, err error) @@ -361,7 +354,7 @@ func Validate(dataFile, schemaFile string, opts *ValidateOptions) (ok bool, err Validate validates the given data file against the specified schema file with the provided options. -## func [ValidateCode]() +## func [ValidateCode](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L182) ```go func ValidateCode(data, code string, opts *ValidateOptions) (ok bool, err error) @@ -369,8 +362,7 @@ func ValidateCode(data, code string, opts *ValidateOptions) (ok bool, err error) ValidateCode validate data string match code string -## type [KCLResult]() - +## type [KCLResult](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L54) ```go type KCLResult = kcl.KCLResult @@ -392,9 +384,9 @@ func main() { const k_code = ` name = "kcl" age = 1 - + two = 2 - + schema Person: name: str = "kcl" age: int = 1 @@ -464,13 +456,13 @@ person: {Name:kcl Age:101}

-## type [KCLResultList]() +## type [KCLResultList](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L55) ```go type KCLResultList = kcl.KCLResultList ``` -### func [MustRun]() +### func [MustRun](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L71) ```go func MustRun(path string, opts ...Option) *KCLResultList @@ -579,8 +571,6 @@ x = Person()
Example (Settings)

- - ```go package main @@ -599,7 +589,7 @@ func main() {

-### func [Run]() +### func [Run](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L76) ```go func Run(path string, opts ...Option) (*KCLResultList, error) @@ -610,8 +600,6 @@ Run evaluates the KCL program with path and opts, then returns the object list.
Example (Get Field)

- - ```go package main @@ -647,7 +635,7 @@ R000A

-### func [RunFiles]() +### func [RunFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L81) ```go func RunFiles(paths []string, opts ...Option) (*KCLResultList, error) @@ -676,13 +664,13 @@ func main() {

-## type [KclType]() +## type [KclType](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L57) ```go type KclType = kcl.KclType ``` -### func [GetSchemaType]() +### func [GetSchemaType](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L210) ```go func GetSchemaType(file, code, schemaName string) ([]*KclType, error) @@ -702,31 +690,31 @@ code: string The kcl code string ``` -schema\_name: string +schema_name: string ``` The schema name got, when the schema name is empty, all schemas are returned. ``` -## type [ListDepFilesOption]() +## type [ListDepFilesOption](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L49) ```go type ListDepFilesOption = list.Option ``` -## type [ListDepsOptions]() +## type [ListDepsOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L48) ```go type ListDepsOptions = list.DepOptions ``` -## type [Option]() +## type [Option](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L47) ```go type Option = kcl.Option ``` -### func [WithCode]() +### func [WithCode](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L86) ```go func WithCode(codes ...string) Option @@ -734,7 +722,7 @@ func WithCode(codes ...string) Option WithCode returns a Option which hold a kcl source code list. -### func [WithDisableNone]() +### func [WithDisableNone](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L110) ```go func WithDisableNone(disableNone bool) Option @@ -742,7 +730,7 @@ func WithDisableNone(disableNone bool) Option WithDisableNone returns a Option which hold a disable none switch. -### func [WithExternalPkgs]() +### func [WithExternalPkgs](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L89) ```go func WithExternalPkgs(externalPkgs ...string) Option @@ -750,7 +738,7 @@ func WithExternalPkgs(externalPkgs ...string) Option WithExternalPkgs returns a Option which hold a external package list. -### func [WithIncludeSchemaTypePath]() +### func [WithIncludeSchemaTypePath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L113) ```go func WithIncludeSchemaTypePath(includeSchemaTypePath bool) Option @@ -758,7 +746,7 @@ func WithIncludeSchemaTypePath(includeSchemaTypePath bool) Option WithIncludeSchemaTypePath returns a Option which hold a include schema type path switch. -### func [WithKFilenames]() +### func [WithKFilenames](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L92) ```go func WithKFilenames(filenames ...string) Option @@ -766,7 +754,7 @@ func WithKFilenames(filenames ...string) Option WithKFilenames returns a Option which hold a filenames list. -### func [WithLogger]() +### func [WithLogger](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L128) ```go func WithLogger(l io.Writer) Option @@ -774,7 +762,7 @@ func WithLogger(l io.Writer) Option WithLogger returns a Option which hold a logger. -### func [WithOptions]() +### func [WithOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L95) ```go func WithOptions(key_value_list ...string) Option @@ -785,8 +773,6 @@ WithOptions returns a Option which hold a key=value pair list for option functio
Example

- - ```go package main @@ -822,7 +808,7 @@ name: kcl

-### func [WithOverrides]() +### func [WithOverrides](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L98) ```go func WithOverrides(override_list ...string) Option @@ -830,7 +816,7 @@ func WithOverrides(override_list ...string) Option WithOverrides returns a Option which hold a override list. -### func [WithPrintOverridesAST]() +### func [WithPrintOverridesAST](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L118) ```go func WithPrintOverridesAST(printOverridesAST bool) Option @@ -838,7 +824,7 @@ func WithPrintOverridesAST(printOverridesAST bool) Option WithPrintOverridesAST returns a Option which hold a printOverridesAST switch. -### func [WithSelectors]() +### func [WithSelectors](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L101) ```go func WithSelectors(selectors ...string) Option @@ -846,7 +832,7 @@ func WithSelectors(selectors ...string) Option WithSelectors returns a Option which hold a path selector list. -### func [WithSettings]() +### func [WithSettings](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L104) ```go func WithSettings(filename string) Option @@ -854,7 +840,7 @@ func WithSettings(filename string) Option WithSettings returns a Option which hold a settings file. -### func [WithSortKeys]() +### func [WithSortKeys](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L123) ```go func WithSortKeys(sortKeys bool) Option @@ -862,7 +848,7 @@ func WithSortKeys(sortKeys bool) Option WithSortKeys returns a Option which hold a sortKeys switch. -### func [WithWorkDir]() +### func [WithWorkDir](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L107) ```go func WithWorkDir(workDir string) Option @@ -870,29 +856,25 @@ func WithWorkDir(workDir string) Option WithWorkDir returns a Option which hold a work dir. -## type [TestCaseInfo]() +## type [TestCaseInfo](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L52) ```go type TestCaseInfo = testing.TestCaseInfo ``` -## type [TestOptions]() - - +## type [TestOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L51) ```go type TestOptions = testing.TestOptions ``` -## type [TestResult]() - - +## type [TestResult](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L53) ```go type TestResult = testing.TestResult ``` -### func [Test]() +### func [Test](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L193) ```go func Test(testOpts *TestOptions, opts ...Option) (TestResult, error) @@ -900,9 +882,7 @@ func Test(testOpts *TestOptions, opts ...Option) (TestResult, error) Test calls the test tool to run uni tests in packages. -## type [ValidateOptions]() - - +## type [ValidateOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L50) ```go type ValidateOptions = validate.ValidateOptions 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 6330e497..d8fce79f 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 @@ -256,7 +256,7 @@ message ExecProgram_Args { repeated string k_filename_list = 2; repeated string k_code_list = 3; - + repeated CmdArgSpec args = 4; repeated CmdOverrideSpec overrides = 5; @@ -287,7 +287,7 @@ message ExecProgram_Args { // Whether only compiling the program bool compile_only = 15; - // Compile the dir recursively + // Compile the dir recursively bool recursive = 16; // -S --path_selector diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/docgen.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/docgen.md index e4e25d4e..2549e1f3 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/docgen.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/docgen.md @@ -54,13 +54,13 @@ val = Schema { 使用 `kcl doc generate` 命令,从用户指定的文件或目录中提取文档,并输出到指定目录。 -为当前 KCL 包生成 Markdown 文档到 `/docs` 目录 (包含 kcl.mod 文件) +为当前 KCL 包生成 Markdown 文档到 `/docs` 目录 (包含 kcl.mod 文件) ```shell kcl doc generate -``` - -为当前 KCL 包生成 HTML 文档到 `/docs` 目录 (包含 kcl.mod 文件) +``` + +为当前 KCL 包生成 HTML 文档到 `/docs` 目录 (包含 kcl.mod 文件) ```shell kcl doc generate --format html @@ -106,7 +106,7 @@ Aliases: Examples: # Generate document for current package kcl doc generate - + Available Commands: generate Generates documents from code and examples diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/lint.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/lint.md index 9e9e8578..dc5757c1 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/lint.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/lint.md @@ -51,13 +51,13 @@ Examples: # Lint multiple files kcl lint path/to/kcl1.k path/to/kcl2.k - + # Lint OCI packages kcl lint oci://ghcr.io/kcl-lang/hello-world - + # Lint the current package kcl lint - + Flags: -D, --argument strings Specify the top-level argument diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/overview.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/overview.md index 9ffff730..925467f8 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/overview.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/overview.md @@ -51,7 +51,7 @@ Flags: -v, --version version for kcl Additional help topics: - kcl + kcl Use "kcl [command] --help" for more information about a command. ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/run.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/run.md index 8078ce98..52a45d16 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/run.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/run.md @@ -22,13 +22,13 @@ Examples: # Run multiple files kcl run path/to/kcl1.k path/to/kcl2.k - + # Run OCI packages kcl run oci://ghcr.io/kcl-lang/hello-world - + # Run the current package kcl run - + Flags: -D, --argument strings Specify the top-level argument diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/test.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/test.md index 93f80f52..36f72135 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/test.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/kcl/test.md @@ -91,7 +91,7 @@ EvaluationError --> hello_test.k:3:1 | 3 | assert a.name == 'kcl2' - | + | | @@ -100,7 +100,7 @@ EvaluationError --> hello_test.k:7:1 | 7 | assert a.age == 123 - | + | | @@ -109,7 +109,7 @@ EvaluationError --> hello_test.k:11:1 | 11 | assert a.name == "kcl2" - | + | | @@ -148,7 +148,7 @@ Examples: # Test with the regex expression filter 'test_func' kcl test ./... --run test_func - + Flags: --fail-fast Exist when meet the first fail test case in the test process. diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/openapi/crd-to-kcl.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/openapi/crd-to-kcl.md index 6313b5d2..bab897f7 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/openapi/crd-to-kcl.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/openapi/crd-to-kcl.md @@ -3,7 +3,7 @@ 命令 ```shell -kcl import -m crd -o ${the_kcl_files_output_dir} -s ${your_CRD.yaml} +kcl import -m crd -o ${the_kcl_files_output_dir} -s ${your_CRD.yaml} ``` # 示例 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/openapi/openapi-to-kcl.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/openapi/openapi-to-kcl.md index 1a965a57..38a62f88 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/openapi/openapi-to-kcl.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/tools/cli/openapi/openapi-to-kcl.md @@ -35,7 +35,7 @@ paths: {} - 命令: ```shell -kcl import -m openapi -o ~/ -s test_open_api_spec.yaml +kcl import -m openapi -o ~/ -s test_open_api_spec.yaml ``` - 输出:~/models/v1/test_int.k diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/reference/xlang-api/go-api.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/reference/xlang-api/go-api.md index cdbc09f2..b82b0fd5 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/reference/xlang-api/go-api.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/reference/xlang-api/go-api.md @@ -95,50 +95,49 @@ x1 = Person { ## Index - [Go API](#go-api) - - [KCL Go SDK](#kcl-go-sdk) - - [Index](#index) - - [Constants](#constants) - - [func FormatCode](#func-formatcode) - - [func FormatPath](#func-formatpath) - - [func GetSchemaTypeMapping](#func-getschematypemapping) - - [func InitKclvmPath](#func-initkclvmpath) - - [func InitKclvmRuntime](#func-initkclvmruntime) - - [func LintPath](#func-lintpath) - - [func ListDepFiles](#func-listdepfiles) - - [func ListDownStreamFiles](#func-listdownstreamfiles) - - [func ListUpStreamFiles](#func-listupstreamfiles) - - [func OverrideFile](#func-overridefile) - - [func Validate](#func-validate) - - [func ValidateCode](#func-validatecode) - - [type KCLResult](#type-kclresult) - - [type KCLResultList](#type-kclresultlist) - - [func MustRun](#func-mustrun) - - [func Run](#func-run) - - [func RunFiles](#func-runfiles) - - [type KclType](#type-kcltype) - - [func GetSchemaType](#func-getschematype) - - [type ListDepFilesOption](#type-listdepfilesoption) - - [type ListDepsOptions](#type-listdepsoptions) - - [type Option](#type-option) - - [func WithCode](#func-withcode) - - [func WithDisableNone](#func-withdisablenone) - - [func WithExternalPkgs](#func-withexternalpkgs) - - [func WithIncludeSchemaTypePath](#func-withincludeschematypepath) - - [func WithKFilenames](#func-withkfilenames) - - [func WithLogger](#func-withlogger) - - [func WithOptions](#func-withoptions) - - [func WithOverrides](#func-withoverrides) - - [func WithPrintOverridesAST](#func-withprintoverridesast) - - [func WithSelectors](#func-withselectors) - - [func WithSettings](#func-withsettings) - - [func WithSortKeys](#func-withsortkeys) - - [func WithWorkDir](#func-withworkdir) - - [type TestCaseInfo](#type-testcaseinfo) - - [type TestOptions](#type-testoptions) - - [type TestResult](#type-testresult) - - [func Test](#func-test) - - [type ValidateOptions](#type-validateoptions) - + - [KCL Go SDK](#kcl-go-sdk) + - [Index](#index) + - [Constants](#constants) + - [func FormatCode](#func-formatcode) + - [func FormatPath](#func-formatpath) + - [func GetSchemaTypeMapping](#func-getschematypemapping) + - [func InitKclvmPath](#func-initkclvmpath) + - [func InitKclvmRuntime](#func-initkclvmruntime) + - [func LintPath](#func-lintpath) + - [func ListDepFiles](#func-listdepfiles) + - [func ListDownStreamFiles](#func-listdownstreamfiles) + - [func ListUpStreamFiles](#func-listupstreamfiles) + - [func OverrideFile](#func-overridefile) + - [func Validate](#func-validate) + - [func ValidateCode](#func-validatecode) + - [type KCLResult](#type-kclresult) + - [type KCLResultList](#type-kclresultlist) + - [func MustRun](#func-mustrun) + - [func Run](#func-run) + - [func RunFiles](#func-runfiles) + - [type KclType](#type-kcltype) + - [func GetSchemaType](#func-getschematype) + - [type ListDepFilesOption](#type-listdepfilesoption) + - [type ListDepsOptions](#type-listdepsoptions) + - [type Option](#type-option) + - [func WithCode](#func-withcode) + - [func WithDisableNone](#func-withdisablenone) + - [func WithExternalPkgs](#func-withexternalpkgs) + - [func WithIncludeSchemaTypePath](#func-withincludeschematypepath) + - [func WithKFilenames](#func-withkfilenames) + - [func WithLogger](#func-withlogger) + - [func WithOptions](#func-withoptions) + - [func WithOverrides](#func-withoverrides) + - [func WithPrintOverridesAST](#func-withprintoverridesast) + - [func WithSelectors](#func-withselectors) + - [func WithSettings](#func-withsettings) + - [func WithSortKeys](#func-withsortkeys) + - [func WithWorkDir](#func-withworkdir) + - [type TestCaseInfo](#type-testcaseinfo) + - [type TestOptions](#type-testoptions) + - [type TestResult](#type-testresult) + - [func Test](#func-test) + - [type ValidateOptions](#type-validateoptions) ## Constants @@ -148,7 +147,7 @@ KclvmAbiVersion is the current kclvm ABI version. const KclvmAbiVersion = scripts.KclvmAbiVersion ``` -## func [FormatCode]() +## func [FormatCode](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L133) ```go func FormatCode(code interface{}) ([]byte, error) @@ -159,8 +158,6 @@ FormatCode returns the formatted code.
Example

- - ```go package main @@ -181,8 +178,6 @@ func main() { } ``` - - ``` a = 1 + 2 ``` @@ -190,7 +185,7 @@ a = 1 + 2

-## func [FormatPath]() +## func [FormatPath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L145) ```go func FormatPath(path string) (changedPaths []string, err error) @@ -203,8 +198,6 @@ the returned changedPaths are the changed file paths \(relative path\)
Example

- - ```go package main @@ -227,7 +220,7 @@ func main() {

-## func [GetSchemaTypeMapping]() +## func [GetSchemaTypeMapping](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L227) ```go func GetSchemaTypeMapping(file, code, schemaName string) (map[string]*KclType, error) @@ -247,13 +240,13 @@ code: string The kcl code string ``` -schema\_name: string +schema_name: string ``` The schema name got, when the schema name is empty, all schemas are returned. ``` -## func [InitKclvmPath]() +## func [InitKclvmPath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L61) ```go func InitKclvmPath(kclvmRoot string) @@ -261,7 +254,7 @@ func InitKclvmPath(kclvmRoot string) InitKclvmPath init kclvm path. -## func [InitKclvmRuntime]() +## func [InitKclvmRuntime](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L66) ```go func InitKclvmRuntime(n int) @@ -269,7 +262,7 @@ func InitKclvmRuntime(n int) InitKclvmRuntime init kclvm process. -## func [LintPath]() +## func [LintPath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L165) ```go func LintPath(paths []string) (results []string, err error) @@ -314,7 +307,7 @@ Module 'a' imported but unused

-## func [ListDepFiles]() +## func [ListDepFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L150) ```go func ListDepFiles(workDir string, opt *ListDepFilesOption) (files []string, err error) @@ -322,7 +315,7 @@ func ListDepFiles(workDir string, opt *ListDepFilesOption) (files []string, err ListDepFiles return the depend files from the given path -## func [ListDownStreamFiles]() +## func [ListDownStreamFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L160) ```go func ListDownStreamFiles(workDir string, opt *ListDepsOptions) ([]string, error) @@ -330,7 +323,7 @@ func ListDownStreamFiles(workDir string, opt *ListDepsOptions) ([]string, error) ListDownStreamFiles return a list of downstream depend files from the given changed path list. -## func [ListUpStreamFiles]() +## func [ListUpStreamFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L155) ```go func ListUpStreamFiles(workDir string, opt *ListDepsOptions) (deps []string, err error) @@ -338,7 +331,7 @@ func ListUpStreamFiles(workDir string, opt *ListDepsOptions) (deps []string, err ListUpStreamFiles return a list of upstream depend files from the given path list -## func [OverrideFile]() +## func [OverrideFile](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L177) ```go func OverrideFile(file string, specs, importPaths []string) (bool, error) @@ -353,7 +346,7 @@ When the pkgpath is '__main__', it can be omitted. importPaths. List of import statements that need to be added -## func [Validate]() +## func [Validate](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L188) ```go func Validate(dataFile, schemaFile string, opts *ValidateOptions) (ok bool, err error) @@ -361,7 +354,7 @@ func Validate(dataFile, schemaFile string, opts *ValidateOptions) (ok bool, err Validate validates the given data file against the specified schema file with the provided options. -## func [ValidateCode]() +## func [ValidateCode](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L182) ```go func ValidateCode(data, code string, opts *ValidateOptions) (ok bool, err error) @@ -369,8 +362,7 @@ func ValidateCode(data, code string, opts *ValidateOptions) (ok bool, err error) ValidateCode validate data string match code string -## type [KCLResult]() - +## type [KCLResult](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L54) ```go type KCLResult = kcl.KCLResult @@ -392,9 +384,9 @@ func main() { const k_code = ` name = "kcl" age = 1 - + two = 2 - + schema Person: name: str = "kcl" age: int = 1 @@ -464,13 +456,13 @@ person: {Name:kcl Age:101}

-## type [KCLResultList]() +## type [KCLResultList](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L55) ```go type KCLResultList = kcl.KCLResultList ``` -### func [MustRun]() +### func [MustRun](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L71) ```go func MustRun(path string, opts ...Option) *KCLResultList @@ -579,8 +571,6 @@ x = Person()
Example (Settings)

- - ```go package main @@ -599,7 +589,7 @@ func main() {

-### func [Run]() +### func [Run](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L76) ```go func Run(path string, opts ...Option) (*KCLResultList, error) @@ -610,8 +600,6 @@ Run evaluates the KCL program with path and opts, then returns the object list.
Example (Get Field)

- - ```go package main @@ -647,7 +635,7 @@ R000A

-### func [RunFiles]() +### func [RunFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L81) ```go func RunFiles(paths []string, opts ...Option) (*KCLResultList, error) @@ -676,13 +664,13 @@ func main() {

-## type [KclType]() +## type [KclType](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L57) ```go type KclType = kcl.KclType ``` -### func [GetSchemaType]() +### func [GetSchemaType](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L210) ```go func GetSchemaType(file, code, schemaName string) ([]*KclType, error) @@ -702,31 +690,31 @@ code: string The kcl code string ``` -schema\_name: string +schema_name: string ``` The schema name got, when the schema name is empty, all schemas are returned. ``` -## type [ListDepFilesOption]() +## type [ListDepFilesOption](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L49) ```go type ListDepFilesOption = list.Option ``` -## type [ListDepsOptions]() +## type [ListDepsOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L48) ```go type ListDepsOptions = list.DepOptions ``` -## type [Option]() +## type [Option](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L47) ```go type Option = kcl.Option ``` -### func [WithCode]() +### func [WithCode](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L86) ```go func WithCode(codes ...string) Option @@ -734,7 +722,7 @@ func WithCode(codes ...string) Option WithCode returns a Option which hold a kcl source code list. -### func [WithDisableNone]() +### func [WithDisableNone](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L110) ```go func WithDisableNone(disableNone bool) Option @@ -742,7 +730,7 @@ func WithDisableNone(disableNone bool) Option WithDisableNone returns a Option which hold a disable none switch. -### func [WithExternalPkgs]() +### func [WithExternalPkgs](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L89) ```go func WithExternalPkgs(externalPkgs ...string) Option @@ -750,7 +738,7 @@ func WithExternalPkgs(externalPkgs ...string) Option WithExternalPkgs returns a Option which hold a external package list. -### func [WithIncludeSchemaTypePath]() +### func [WithIncludeSchemaTypePath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L113) ```go func WithIncludeSchemaTypePath(includeSchemaTypePath bool) Option @@ -758,7 +746,7 @@ func WithIncludeSchemaTypePath(includeSchemaTypePath bool) Option WithIncludeSchemaTypePath returns a Option which hold a include schema type path switch. -### func [WithKFilenames]() +### func [WithKFilenames](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L92) ```go func WithKFilenames(filenames ...string) Option @@ -766,7 +754,7 @@ func WithKFilenames(filenames ...string) Option WithKFilenames returns a Option which hold a filenames list. -### func [WithLogger]() +### func [WithLogger](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L128) ```go func WithLogger(l io.Writer) Option @@ -774,7 +762,7 @@ func WithLogger(l io.Writer) Option WithLogger returns a Option which hold a logger. -### func [WithOptions]() +### func [WithOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L95) ```go func WithOptions(key_value_list ...string) Option @@ -785,8 +773,6 @@ WithOptions returns a Option which hold a key=value pair list for option functio
Example

- - ```go package main @@ -822,7 +808,7 @@ name: kcl

-### func [WithOverrides]() +### func [WithOverrides](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L98) ```go func WithOverrides(override_list ...string) Option @@ -830,7 +816,7 @@ func WithOverrides(override_list ...string) Option WithOverrides returns a Option which hold a override list. -### func [WithPrintOverridesAST]() +### func [WithPrintOverridesAST](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L118) ```go func WithPrintOverridesAST(printOverridesAST bool) Option @@ -838,7 +824,7 @@ func WithPrintOverridesAST(printOverridesAST bool) Option WithPrintOverridesAST returns a Option which hold a printOverridesAST switch. -### func [WithSelectors]() +### func [WithSelectors](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L101) ```go func WithSelectors(selectors ...string) Option @@ -846,7 +832,7 @@ func WithSelectors(selectors ...string) Option WithSelectors returns a Option which hold a path selector list. -### func [WithSettings]() +### func [WithSettings](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L104) ```go func WithSettings(filename string) Option @@ -854,7 +840,7 @@ func WithSettings(filename string) Option WithSettings returns a Option which hold a settings file. -### func [WithSortKeys]() +### func [WithSortKeys](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L123) ```go func WithSortKeys(sortKeys bool) Option @@ -862,7 +848,7 @@ func WithSortKeys(sortKeys bool) Option WithSortKeys returns a Option which hold a sortKeys switch. -### func [WithWorkDir]() +### func [WithWorkDir](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L107) ```go func WithWorkDir(workDir string) Option @@ -870,29 +856,25 @@ func WithWorkDir(workDir string) Option WithWorkDir returns a Option which hold a work dir. -## type [TestCaseInfo]() +## type [TestCaseInfo](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L52) ```go type TestCaseInfo = testing.TestCaseInfo ``` -## type [TestOptions]() - - +## type [TestOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L51) ```go type TestOptions = testing.TestOptions ``` -## type [TestResult]() - - +## type [TestResult](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L53) ```go type TestResult = testing.TestResult ``` -### func [Test]() +### func [Test](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L193) ```go func Test(testOpts *TestOptions, opts ...Option) (TestResult, error) @@ -900,9 +882,7 @@ func Test(testOpts *TestOptions, opts ...Option) (TestResult, error) Test calls the test tool to run uni tests in packages. -## type [ValidateOptions]() - - +## type [ValidateOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L50) ```go type ValidateOptions = validate.ValidateOptions diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/reference/xlang-api/rest-api.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/reference/xlang-api/rest-api.md index 6330e497..d8fce79f 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/reference/xlang-api/rest-api.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/reference/xlang-api/rest-api.md @@ -256,7 +256,7 @@ message ExecProgram_Args { repeated string k_filename_list = 2; repeated string k_code_list = 3; - + repeated CmdArgSpec args = 4; repeated CmdOverrideSpec overrides = 5; @@ -287,7 +287,7 @@ message ExecProgram_Args { // Whether only compiling the program bool compile_only = 15; - // Compile the dir recursively + // Compile the dir recursively bool recursive = 16; // -S --path_selector diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/docgen.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/docgen.md index e4e25d4e..2549e1f3 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/docgen.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/docgen.md @@ -54,13 +54,13 @@ val = Schema { 使用 `kcl doc generate` 命令,从用户指定的文件或目录中提取文档,并输出到指定目录。 -为当前 KCL 包生成 Markdown 文档到 `/docs` 目录 (包含 kcl.mod 文件) +为当前 KCL 包生成 Markdown 文档到 `/docs` 目录 (包含 kcl.mod 文件) ```shell kcl doc generate -``` - -为当前 KCL 包生成 HTML 文档到 `/docs` 目录 (包含 kcl.mod 文件) +``` + +为当前 KCL 包生成 HTML 文档到 `/docs` 目录 (包含 kcl.mod 文件) ```shell kcl doc generate --format html @@ -106,7 +106,7 @@ Aliases: Examples: # Generate document for current package kcl doc generate - + Available Commands: generate Generates documents from code and examples diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/lint.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/lint.md index 9e9e8578..dc5757c1 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/lint.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/lint.md @@ -51,13 +51,13 @@ Examples: # Lint multiple files kcl lint path/to/kcl1.k path/to/kcl2.k - + # Lint OCI packages kcl lint oci://ghcr.io/kcl-lang/hello-world - + # Lint the current package kcl lint - + Flags: -D, --argument strings Specify the top-level argument diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/overview.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/overview.md index 9ffff730..925467f8 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/overview.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/overview.md @@ -51,7 +51,7 @@ Flags: -v, --version version for kcl Additional help topics: - kcl + kcl Use "kcl [command] --help" for more information about a command. ``` diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/run.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/run.md index 8078ce98..52a45d16 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/run.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/run.md @@ -22,13 +22,13 @@ Examples: # Run multiple files kcl run path/to/kcl1.k path/to/kcl2.k - + # Run OCI packages kcl run oci://ghcr.io/kcl-lang/hello-world - + # Run the current package kcl run - + Flags: -D, --argument strings Specify the top-level argument diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/test.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/test.md index 93f80f52..36f72135 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/test.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/kcl/test.md @@ -91,7 +91,7 @@ EvaluationError --> hello_test.k:3:1 | 3 | assert a.name == 'kcl2' - | + | | @@ -100,7 +100,7 @@ EvaluationError --> hello_test.k:7:1 | 7 | assert a.age == 123 - | + | | @@ -109,7 +109,7 @@ EvaluationError --> hello_test.k:11:1 | 11 | assert a.name == "kcl2" - | + | | @@ -148,7 +148,7 @@ Examples: # Test with the regex expression filter 'test_func' kcl test ./... --run test_func - + Flags: --fail-fast Exist when meet the first fail test case in the test process. diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/openapi/crd-to-kcl.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/openapi/crd-to-kcl.md index 6313b5d2..bab897f7 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/openapi/crd-to-kcl.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/openapi/crd-to-kcl.md @@ -3,7 +3,7 @@ 命令 ```shell -kcl import -m crd -o ${the_kcl_files_output_dir} -s ${your_CRD.yaml} +kcl import -m crd -o ${the_kcl_files_output_dir} -s ${your_CRD.yaml} ``` # 示例 diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/openapi/openapi-to-kcl.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/openapi/openapi-to-kcl.md index 1a965a57..38a62f88 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/openapi/openapi-to-kcl.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/openapi/openapi-to-kcl.md @@ -35,7 +35,7 @@ paths: {} - 命令: ```shell -kcl import -m openapi -o ~/ -s test_open_api_spec.yaml +kcl import -m openapi -o ~/ -s test_open_api_spec.yaml ``` - 输出:~/models/v1/test_int.k diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/openapi/quick-start.md b/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/openapi/quick-start.md deleted file mode 100644 index 1009075f..00000000 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/version-0.7.0/tools/cli/openapi/quick-start.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -sidebar_position: 1 ---- - -# 快速开始 - -## 1. 安装 KCLOpenAPI 工具 - -目前有多种安装方式可选: - -- [通过 go install 安装](#11-通过-go-install-安装) -- [通过 curl|sh 安装(仅限 MacOS & Linux)](#12-通过-curlsh-安装(仅限-MacOS--Linux)) -- [下载发布包](#13-下载发布包) - -## 1.1 通过 go install 安装 - -```shell -go install kcl-lang.io/kcl-openapi@latest -``` - -## 1.2 通过 curl|sh 安装(仅限 MacOS & Linux) - -```shell -curl -fsSL https://kcl-lang.io/script/install-kcl-openapi.sh | /bin/bash -``` - -## 1.3 下载发布包 - -```shell -# 1. 下载二进制程序 -# https://github.com/kcl-lang/kcl-openapi/releases - -# 2. 解压发布包,并将命令添加至 PATH -export PATH=":$PATH" -``` - -## 1.4 验证安装结果 - -```shell -➜ kcl-openapi -v -kcl-openapi 0.5.0 -``` - -## 2. 生成 KCL 文件 - -- [将 OpenAPI 描述文件转换为 KCL](../openapi/openapi-to-kcl.md) -- [将 Kubernetes CRD 转换为 KCL](../openapi/crd-to-kcl.md) diff --git a/versioned_docs/version-0.7.0/community/contribute/git-guideline.md b/versioned_docs/version-0.7.0/community/contribute/git-guideline.md index 7d427c01..9bebc635 100644 --- a/versioned_docs/version-0.7.0/community/contribute/git-guideline.md +++ b/versioned_docs/version-0.7.0/community/contribute/git-guideline.md @@ -32,7 +32,7 @@ The branch name mainly includes two fields, which are separated by "-". Includin For example, Alice first transfers the Fork warehouse to his own account, and then creates a branch with the corresponding name 'alice: fix output fmt bug' (Alice's account is before the colon) to fix the output formatting bug. -## 3. 关于 Git Commit +## 3. About Git Commit We refer to [Commitizen](https://github.com/commitizen/cz-cli) to write a Commit Message. diff --git a/versioned_docs/version-0.7.0/community/release-policy/kcl.md b/versioned_docs/version-0.7.0/community/release-policy/kcl.md index 5772bf49..3298ecc3 100644 --- a/versioned_docs/version-0.7.0/community/release-policy/kcl.md +++ b/versioned_docs/version-0.7.0/community/release-policy/kcl.md @@ -14,7 +14,7 @@ The KCL project version release strategy is as follows: ## Release Process and Rules - Feature Development: Main branch development, branch releases, block user issues, critical bugs, security vulnerabilities, and high-priority fixes. It is given higher priority over general feature development and should be completed within a week. -Iteration Cycle: The iteration cycle is typically 3 months, with a new minor version released every 3 months. +- Iteration Cycle: The iteration cycle is typically 3 months, with a new minor version released every 3 months. - Version Planning: Two weeks before the release, an alpha version is produced, followed by a beta version one week before the release. Alpha versions can still include feature merging, while beta versions only include bug fixes. The final release version is tagged as a long-term saved release branch. - Release Plan: A detailed release plan (Github Milestone) is created at the beginning of each release cycle, including release dates, version numbers, feature lists, and testing plans. The release plan should be followed as closely as possible to ensure timely releases. - Pre-release Testing: Comprehensive testing, including unit testing, integration testing, fuzz testing, stress testing, and user acceptance testing, is conducted before releasing a new version. The new version is only released when it passes all tests without any issues. diff --git a/versioned_docs/version-0.7.0/reference/xlang-api/go-api.md b/versioned_docs/version-0.7.0/reference/xlang-api/go-api.md index cdbc09f2..b82b0fd5 100644 --- a/versioned_docs/version-0.7.0/reference/xlang-api/go-api.md +++ b/versioned_docs/version-0.7.0/reference/xlang-api/go-api.md @@ -95,50 +95,49 @@ x1 = Person { ## Index - [Go API](#go-api) - - [KCL Go SDK](#kcl-go-sdk) - - [Index](#index) - - [Constants](#constants) - - [func FormatCode](#func-formatcode) - - [func FormatPath](#func-formatpath) - - [func GetSchemaTypeMapping](#func-getschematypemapping) - - [func InitKclvmPath](#func-initkclvmpath) - - [func InitKclvmRuntime](#func-initkclvmruntime) - - [func LintPath](#func-lintpath) - - [func ListDepFiles](#func-listdepfiles) - - [func ListDownStreamFiles](#func-listdownstreamfiles) - - [func ListUpStreamFiles](#func-listupstreamfiles) - - [func OverrideFile](#func-overridefile) - - [func Validate](#func-validate) - - [func ValidateCode](#func-validatecode) - - [type KCLResult](#type-kclresult) - - [type KCLResultList](#type-kclresultlist) - - [func MustRun](#func-mustrun) - - [func Run](#func-run) - - [func RunFiles](#func-runfiles) - - [type KclType](#type-kcltype) - - [func GetSchemaType](#func-getschematype) - - [type ListDepFilesOption](#type-listdepfilesoption) - - [type ListDepsOptions](#type-listdepsoptions) - - [type Option](#type-option) - - [func WithCode](#func-withcode) - - [func WithDisableNone](#func-withdisablenone) - - [func WithExternalPkgs](#func-withexternalpkgs) - - [func WithIncludeSchemaTypePath](#func-withincludeschematypepath) - - [func WithKFilenames](#func-withkfilenames) - - [func WithLogger](#func-withlogger) - - [func WithOptions](#func-withoptions) - - [func WithOverrides](#func-withoverrides) - - [func WithPrintOverridesAST](#func-withprintoverridesast) - - [func WithSelectors](#func-withselectors) - - [func WithSettings](#func-withsettings) - - [func WithSortKeys](#func-withsortkeys) - - [func WithWorkDir](#func-withworkdir) - - [type TestCaseInfo](#type-testcaseinfo) - - [type TestOptions](#type-testoptions) - - [type TestResult](#type-testresult) - - [func Test](#func-test) - - [type ValidateOptions](#type-validateoptions) - + - [KCL Go SDK](#kcl-go-sdk) + - [Index](#index) + - [Constants](#constants) + - [func FormatCode](#func-formatcode) + - [func FormatPath](#func-formatpath) + - [func GetSchemaTypeMapping](#func-getschematypemapping) + - [func InitKclvmPath](#func-initkclvmpath) + - [func InitKclvmRuntime](#func-initkclvmruntime) + - [func LintPath](#func-lintpath) + - [func ListDepFiles](#func-listdepfiles) + - [func ListDownStreamFiles](#func-listdownstreamfiles) + - [func ListUpStreamFiles](#func-listupstreamfiles) + - [func OverrideFile](#func-overridefile) + - [func Validate](#func-validate) + - [func ValidateCode](#func-validatecode) + - [type KCLResult](#type-kclresult) + - [type KCLResultList](#type-kclresultlist) + - [func MustRun](#func-mustrun) + - [func Run](#func-run) + - [func RunFiles](#func-runfiles) + - [type KclType](#type-kcltype) + - [func GetSchemaType](#func-getschematype) + - [type ListDepFilesOption](#type-listdepfilesoption) + - [type ListDepsOptions](#type-listdepsoptions) + - [type Option](#type-option) + - [func WithCode](#func-withcode) + - [func WithDisableNone](#func-withdisablenone) + - [func WithExternalPkgs](#func-withexternalpkgs) + - [func WithIncludeSchemaTypePath](#func-withincludeschematypepath) + - [func WithKFilenames](#func-withkfilenames) + - [func WithLogger](#func-withlogger) + - [func WithOptions](#func-withoptions) + - [func WithOverrides](#func-withoverrides) + - [func WithPrintOverridesAST](#func-withprintoverridesast) + - [func WithSelectors](#func-withselectors) + - [func WithSettings](#func-withsettings) + - [func WithSortKeys](#func-withsortkeys) + - [func WithWorkDir](#func-withworkdir) + - [type TestCaseInfo](#type-testcaseinfo) + - [type TestOptions](#type-testoptions) + - [type TestResult](#type-testresult) + - [func Test](#func-test) + - [type ValidateOptions](#type-validateoptions) ## Constants @@ -148,7 +147,7 @@ KclvmAbiVersion is the current kclvm ABI version. const KclvmAbiVersion = scripts.KclvmAbiVersion ``` -## func [FormatCode]() +## func [FormatCode](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L133) ```go func FormatCode(code interface{}) ([]byte, error) @@ -159,8 +158,6 @@ FormatCode returns the formatted code.
Example

- - ```go package main @@ -181,8 +178,6 @@ func main() { } ``` - - ``` a = 1 + 2 ``` @@ -190,7 +185,7 @@ a = 1 + 2

-## func [FormatPath]() +## func [FormatPath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L145) ```go func FormatPath(path string) (changedPaths []string, err error) @@ -203,8 +198,6 @@ the returned changedPaths are the changed file paths \(relative path\)
Example

- - ```go package main @@ -227,7 +220,7 @@ func main() {

-## func [GetSchemaTypeMapping]() +## func [GetSchemaTypeMapping](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L227) ```go func GetSchemaTypeMapping(file, code, schemaName string) (map[string]*KclType, error) @@ -247,13 +240,13 @@ code: string The kcl code string ``` -schema\_name: string +schema_name: string ``` The schema name got, when the schema name is empty, all schemas are returned. ``` -## func [InitKclvmPath]() +## func [InitKclvmPath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L61) ```go func InitKclvmPath(kclvmRoot string) @@ -261,7 +254,7 @@ func InitKclvmPath(kclvmRoot string) InitKclvmPath init kclvm path. -## func [InitKclvmRuntime]() +## func [InitKclvmRuntime](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L66) ```go func InitKclvmRuntime(n int) @@ -269,7 +262,7 @@ func InitKclvmRuntime(n int) InitKclvmRuntime init kclvm process. -## func [LintPath]() +## func [LintPath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L165) ```go func LintPath(paths []string) (results []string, err error) @@ -314,7 +307,7 @@ Module 'a' imported but unused

-## func [ListDepFiles]() +## func [ListDepFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L150) ```go func ListDepFiles(workDir string, opt *ListDepFilesOption) (files []string, err error) @@ -322,7 +315,7 @@ func ListDepFiles(workDir string, opt *ListDepFilesOption) (files []string, err ListDepFiles return the depend files from the given path -## func [ListDownStreamFiles]() +## func [ListDownStreamFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L160) ```go func ListDownStreamFiles(workDir string, opt *ListDepsOptions) ([]string, error) @@ -330,7 +323,7 @@ func ListDownStreamFiles(workDir string, opt *ListDepsOptions) ([]string, error) ListDownStreamFiles return a list of downstream depend files from the given changed path list. -## func [ListUpStreamFiles]() +## func [ListUpStreamFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L155) ```go func ListUpStreamFiles(workDir string, opt *ListDepsOptions) (deps []string, err error) @@ -338,7 +331,7 @@ func ListUpStreamFiles(workDir string, opt *ListDepsOptions) (deps []string, err ListUpStreamFiles return a list of upstream depend files from the given path list -## func [OverrideFile]() +## func [OverrideFile](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L177) ```go func OverrideFile(file string, specs, importPaths []string) (bool, error) @@ -353,7 +346,7 @@ When the pkgpath is '__main__', it can be omitted. importPaths. List of import statements that need to be added -## func [Validate]() +## func [Validate](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L188) ```go func Validate(dataFile, schemaFile string, opts *ValidateOptions) (ok bool, err error) @@ -361,7 +354,7 @@ func Validate(dataFile, schemaFile string, opts *ValidateOptions) (ok bool, err Validate validates the given data file against the specified schema file with the provided options. -## func [ValidateCode]() +## func [ValidateCode](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L182) ```go func ValidateCode(data, code string, opts *ValidateOptions) (ok bool, err error) @@ -369,8 +362,7 @@ func ValidateCode(data, code string, opts *ValidateOptions) (ok bool, err error) ValidateCode validate data string match code string -## type [KCLResult]() - +## type [KCLResult](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L54) ```go type KCLResult = kcl.KCLResult @@ -392,9 +384,9 @@ func main() { const k_code = ` name = "kcl" age = 1 - + two = 2 - + schema Person: name: str = "kcl" age: int = 1 @@ -464,13 +456,13 @@ person: {Name:kcl Age:101}

-## type [KCLResultList]() +## type [KCLResultList](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L55) ```go type KCLResultList = kcl.KCLResultList ``` -### func [MustRun]() +### func [MustRun](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L71) ```go func MustRun(path string, opts ...Option) *KCLResultList @@ -579,8 +571,6 @@ x = Person()
Example (Settings)

- - ```go package main @@ -599,7 +589,7 @@ func main() {

-### func [Run]() +### func [Run](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L76) ```go func Run(path string, opts ...Option) (*KCLResultList, error) @@ -610,8 +600,6 @@ Run evaluates the KCL program with path and opts, then returns the object list.
Example (Get Field)

- - ```go package main @@ -647,7 +635,7 @@ R000A

-### func [RunFiles]() +### func [RunFiles](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L81) ```go func RunFiles(paths []string, opts ...Option) (*KCLResultList, error) @@ -676,13 +664,13 @@ func main() {

-## type [KclType]() +## type [KclType](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L57) ```go type KclType = kcl.KclType ``` -### func [GetSchemaType]() +### func [GetSchemaType](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L210) ```go func GetSchemaType(file, code, schemaName string) ([]*KclType, error) @@ -702,31 +690,31 @@ code: string The kcl code string ``` -schema\_name: string +schema_name: string ``` The schema name got, when the schema name is empty, all schemas are returned. ``` -## type [ListDepFilesOption]() +## type [ListDepFilesOption](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L49) ```go type ListDepFilesOption = list.Option ``` -## type [ListDepsOptions]() +## type [ListDepsOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L48) ```go type ListDepsOptions = list.DepOptions ``` -## type [Option]() +## type [Option](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L47) ```go type Option = kcl.Option ``` -### func [WithCode]() +### func [WithCode](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L86) ```go func WithCode(codes ...string) Option @@ -734,7 +722,7 @@ func WithCode(codes ...string) Option WithCode returns a Option which hold a kcl source code list. -### func [WithDisableNone]() +### func [WithDisableNone](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L110) ```go func WithDisableNone(disableNone bool) Option @@ -742,7 +730,7 @@ func WithDisableNone(disableNone bool) Option WithDisableNone returns a Option which hold a disable none switch. -### func [WithExternalPkgs]() +### func [WithExternalPkgs](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L89) ```go func WithExternalPkgs(externalPkgs ...string) Option @@ -750,7 +738,7 @@ func WithExternalPkgs(externalPkgs ...string) Option WithExternalPkgs returns a Option which hold a external package list. -### func [WithIncludeSchemaTypePath]() +### func [WithIncludeSchemaTypePath](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L113) ```go func WithIncludeSchemaTypePath(includeSchemaTypePath bool) Option @@ -758,7 +746,7 @@ func WithIncludeSchemaTypePath(includeSchemaTypePath bool) Option WithIncludeSchemaTypePath returns a Option which hold a include schema type path switch. -### func [WithKFilenames]() +### func [WithKFilenames](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L92) ```go func WithKFilenames(filenames ...string) Option @@ -766,7 +754,7 @@ func WithKFilenames(filenames ...string) Option WithKFilenames returns a Option which hold a filenames list. -### func [WithLogger]() +### func [WithLogger](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L128) ```go func WithLogger(l io.Writer) Option @@ -774,7 +762,7 @@ func WithLogger(l io.Writer) Option WithLogger returns a Option which hold a logger. -### func [WithOptions]() +### func [WithOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L95) ```go func WithOptions(key_value_list ...string) Option @@ -785,8 +773,6 @@ WithOptions returns a Option which hold a key=value pair list for option functio
Example

- - ```go package main @@ -822,7 +808,7 @@ name: kcl

-### func [WithOverrides]() +### func [WithOverrides](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L98) ```go func WithOverrides(override_list ...string) Option @@ -830,7 +816,7 @@ func WithOverrides(override_list ...string) Option WithOverrides returns a Option which hold a override list. -### func [WithPrintOverridesAST]() +### func [WithPrintOverridesAST](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L118) ```go func WithPrintOverridesAST(printOverridesAST bool) Option @@ -838,7 +824,7 @@ func WithPrintOverridesAST(printOverridesAST bool) Option WithPrintOverridesAST returns a Option which hold a printOverridesAST switch. -### func [WithSelectors]() +### func [WithSelectors](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L101) ```go func WithSelectors(selectors ...string) Option @@ -846,7 +832,7 @@ func WithSelectors(selectors ...string) Option WithSelectors returns a Option which hold a path selector list. -### func [WithSettings]() +### func [WithSettings](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L104) ```go func WithSettings(filename string) Option @@ -854,7 +840,7 @@ func WithSettings(filename string) Option WithSettings returns a Option which hold a settings file. -### func [WithSortKeys]() +### func [WithSortKeys](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L123) ```go func WithSortKeys(sortKeys bool) Option @@ -862,7 +848,7 @@ func WithSortKeys(sortKeys bool) Option WithSortKeys returns a Option which hold a sortKeys switch. -### func [WithWorkDir]() +### func [WithWorkDir](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L107) ```go func WithWorkDir(workDir string) Option @@ -870,29 +856,25 @@ func WithWorkDir(workDir string) Option WithWorkDir returns a Option which hold a work dir. -## type [TestCaseInfo]() +## type [TestCaseInfo](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L52) ```go type TestCaseInfo = testing.TestCaseInfo ``` -## type [TestOptions]() - - +## type [TestOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L51) ```go type TestOptions = testing.TestOptions ``` -## type [TestResult]() - - +## type [TestResult](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L53) ```go type TestResult = testing.TestResult ``` -### func [Test]() +### func [Test](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L193) ```go func Test(testOpts *TestOptions, opts ...Option) (TestResult, error) @@ -900,9 +882,7 @@ func Test(testOpts *TestOptions, opts ...Option) (TestResult, error) Test calls the test tool to run uni tests in packages. -## type [ValidateOptions]() - - +## type [ValidateOptions](https://github.com/kcl-lang/kcl-go/blob/main/kclvm.go#L50) ```go type ValidateOptions = validate.ValidateOptions diff --git a/versioned_docs/version-0.7.0/reference/xlang-api/rest-api.md b/versioned_docs/version-0.7.0/reference/xlang-api/rest-api.md index 17966c5a..483b8973 100644 --- a/versioned_docs/version-0.7.0/reference/xlang-api/rest-api.md +++ b/versioned_docs/version-0.7.0/reference/xlang-api/rest-api.md @@ -244,7 +244,7 @@ message ExecProgram_Args { repeated string k_filename_list = 2; repeated string k_code_list = 3; - + repeated CmdArgSpec args = 4; repeated CmdOverrideSpec overrides = 5; @@ -275,7 +275,7 @@ message ExecProgram_Args { // Whether only compiling the program bool compile_only = 15; - // Compile the dir recursively + // Compile the dir recursively bool recursive = 16; // -S --path_selector diff --git a/versioned_docs/version-0.7.0/tools/cli/kcl/docgen.md b/versioned_docs/version-0.7.0/tools/cli/kcl/docgen.md index 8fd72421..59a1abc5 100644 --- a/versioned_docs/version-0.7.0/tools/cli/kcl/docgen.md +++ b/versioned_docs/version-0.7.0/tools/cli/kcl/docgen.md @@ -58,8 +58,8 @@ Generate Markdown document for current package with a `kcl.mod` file. ```shell kcl doc generate -``` - +``` + Generate HTML document for current package ```shell @@ -106,7 +106,7 @@ Aliases: Examples: # Generate document for current package kcl doc generate - + Available Commands: generate Generates documents from code and examples diff --git a/versioned_docs/version-0.7.0/tools/cli/kcl/import.md b/versioned_docs/version-0.7.0/tools/cli/kcl/import.md index a8873190..fd30a719 100644 --- a/versioned_docs/version-0.7.0/tools/cli/kcl/import.md +++ b/versioned_docs/version-0.7.0/tools/cli/kcl/import.md @@ -2,7 +2,7 @@ sidebar_position: 4 --- -# Import +# Import ## Introduction diff --git a/versioned_docs/version-0.7.0/tools/cli/kcl/lint.md b/versioned_docs/version-0.7.0/tools/cli/kcl/lint.md index 2434b634..bf628240 100644 --- a/versioned_docs/version-0.7.0/tools/cli/kcl/lint.md +++ b/versioned_docs/version-0.7.0/tools/cli/kcl/lint.md @@ -51,13 +51,13 @@ Examples: # Lint multiple files kcl lint path/to/kcl1.k path/to/kcl2.k - + # Lint OCI packages kcl lint oci://ghcr.io/kcl-lang/hello-world - + # Lint the current package kcl lint - + Flags: -D, --argument strings Specify the top-level argument diff --git a/versioned_docs/version-0.7.0/tools/cli/kcl/overview.md b/versioned_docs/version-0.7.0/tools/cli/kcl/overview.md index 2406c437..08bf7634 100644 --- a/versioned_docs/version-0.7.0/tools/cli/kcl/overview.md +++ b/versioned_docs/version-0.7.0/tools/cli/kcl/overview.md @@ -51,7 +51,7 @@ Flags: -v, --version version for kcl Additional help topics: - kcl + kcl Use "kcl [command] --help" for more information about a command. ``` diff --git a/versioned_docs/version-0.7.0/tools/cli/kcl/run.md b/versioned_docs/version-0.7.0/tools/cli/kcl/run.md index de9f0436..b5b6c883 100644 --- a/versioned_docs/version-0.7.0/tools/cli/kcl/run.md +++ b/versioned_docs/version-0.7.0/tools/cli/kcl/run.md @@ -24,13 +24,13 @@ Examples: # Run multiple files kcl run path/to/kcl1.k path/to/kcl2.k - + # Run OCI packages kcl run oci://ghcr.io/kcl-lang/hello-world - + # Run the current package kcl run - + Flags: -D, --argument strings Specify the top-level argument diff --git a/versioned_docs/version-0.7.0/tools/cli/kcl/test.md b/versioned_docs/version-0.7.0/tools/cli/kcl/test.md index 6c310aa3..18f5a9d0 100644 --- a/versioned_docs/version-0.7.0/tools/cli/kcl/test.md +++ b/versioned_docs/version-0.7.0/tools/cli/kcl/test.md @@ -91,7 +91,7 @@ EvaluationError --> hello_test.k:3:1 | 3 | assert a.name == 'kcl2' - | + | | @@ -100,7 +100,7 @@ EvaluationError --> hello_test.k:7:1 | 7 | assert a.age == 123 - | + | | @@ -109,7 +109,7 @@ EvaluationError --> hello_test.k:11:1 | 11 | assert a.name == "kcl2" - | + | | @@ -148,7 +148,7 @@ Examples: # Test with the regex expression filter 'test_func' kcl test ./... --run test_func - + Flags: --fail-fast Exist when meet the first fail test case in the test process. diff --git a/versioned_docs/version-0.7.0/tools/cli/openapi/crd-to-kcl.md b/versioned_docs/version-0.7.0/tools/cli/openapi/crd-to-kcl.md index d1c05e24..d07ed58b 100644 --- a/versioned_docs/version-0.7.0/tools/cli/openapi/crd-to-kcl.md +++ b/versioned_docs/version-0.7.0/tools/cli/openapi/crd-to-kcl.md @@ -3,7 +3,7 @@ To convert from models defined in the Kubernetes CRD file to KCL schema, we could run the following script: ```shell -kcl import -m crd -o ${the_kcl_files_output_dir} -s ${your_CRD.yaml} +kcl import -m crd -o ${the_kcl_files_output_dir} -s ${your_CRD.yaml} ``` ## Example @@ -58,7 +58,7 @@ spec: - The script will be: ```shell -kcl import -m crd -o ~/ -s test_crontab_CRD.yaml +kcl import -m crd -o ~/ -s test_crontab_CRD.yaml ``` - Then we can find the generated file here: `~/models/stable_example_com_v1_cron_tab.k` diff --git a/versioned_docs/version-0.7.0/tools/cli/openapi/openapi-to-kcl.md b/versioned_docs/version-0.7.0/tools/cli/openapi/openapi-to-kcl.md index 316f892c..997dc792 100644 --- a/versioned_docs/version-0.7.0/tools/cli/openapi/openapi-to-kcl.md +++ b/versioned_docs/version-0.7.0/tools/cli/openapi/openapi-to-kcl.md @@ -35,7 +35,7 @@ paths: {} - The script will be: ```shell -kcl import -m openapi -o ~/ -s test_open_api_spec.yaml +kcl import -m openapi -o ~/ -s test_open_api_spec.yaml ``` - Then we can find the generated file here: `~/models/v1/test_int.k` diff --git a/versioned_docs/version-0.7.0/tools/cli/openapi/quick-start.md b/versioned_docs/version-0.7.0/tools/cli/openapi/quick-start.md deleted file mode 100644 index 24091f9e..00000000 --- a/versioned_docs/version-0.7.0/tools/cli/openapi/quick-start.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -sidebar_position: 1 ---- - -# Quick Start - -## 1. Install KCLOpenAPI Tool - -The kcl-openapi tool can be installed in following ways: - -- [Quick Start](#quick-start) - - [1. Install KCLOpenAPI Tool](#1-install-kclopenapi-tool) - - [1.1 go install](#11-go-install) - - [1.2 Curl|sh install (MacOS \& Linux)](#12-curlsh-install-macos--linux) - - [1.3 Download from release](#13-download-from-release) - - [1.4 Verify your installation](#14-verify-your-installation) - - [2. Generate KCL Files](#2-generate-kcl-files) - -## 1.1 go install - -```shell -go install kcl-lang.io/kcl-openapi@latest -``` - -## 1.2 Curl|sh install (MacOS & Linux) - -If you don't have go, you can install the CLI with this one-liner: - -```shell -curl -fsSL https://kcl-lang.io/script/install-kcl-openapi.sh | /bin/bash -``` - -## 1.3 Download from release - -```shell -# 1. download the released binary from: -# https://github.com/kcl-lang/kcl-openapi/releases - -# 2. Unzip the package and add the binary location to PATH -export PATH=":$PATH" -``` - -## 1.4 Verify your installation - -```shell -➜ kcl-openapi -v -kcl-openapi 0.5.0 -``` - -## 2. Generate KCL Files - -- [OpenAPI to KCL](../openapi/openapi-to-kcl.md) -- [CRD to KCL](../openapi/crd-to-kcl.md)