diff --git a/Makefile b/Makefile index 6b43cbfb..ff6c29d5 100644 --- a/Makefile +++ b/Makefile @@ -16,9 +16,6 @@ RUN_IN_DOCKER+=-v ~/.gitconfig:/root/.gitconfig RUN_IN_DOCKER+=-v ${PWD}:/root/kcl RUN_IN_DOCKER+=-w /root/kcl ${BUILD_IMAGE} -default: - go run ./cmds/kcl-go run hello.k - clean: -rm -rf ./_build diff --git a/README.md b/README.md index 8a5dcd6a..d8d2e8f1 100644 --- a/README.md +++ b/README.md @@ -18,25 +18,10 @@ You can use KCL to + Mutating or validating Kubernetes resources with [cloud-native configuration tool plugins](https://kcl-lang.io/docs/user_docs/guides/working-with-k8s/). + Used as a platform engineering programming language to deliver modern applications with [Kusion Stack](https://kusionstack.io). -## Building +## Building & Testing - [Install Go 1.19+](https://go.dev/dl/) -```bash -go run ./cmds/kcl-go run hello.k -name: kcl -age: 1 -two: 2 -x0: - name: kcl - age: 1 -x1: - name: kcl - age: 101 -``` - -## Testing - ```bash go test ./... ``` diff --git a/cmds/kcl-go/command/cmd_build_info.go b/cmds/kcl-go/command/cmd_build_info.go deleted file mode 100644 index 1157a182..00000000 --- a/cmds/kcl-go/command/cmd_build_info.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2023 The KCL Authors. All rights reserved. - -package command - -import ( - "encoding/json" - "fmt" - "os" - "runtime/debug" - - "github.com/urfave/cli/v2" -) - -func NewBuildInfoCmd() *cli.Command { - return &cli.Command{ - Hidden: false, - Name: "build-info", - Usage: "print build info", - Action: func(c *cli.Context) error { - if info, ok := debug.ReadBuildInfo(); ok { - if d, err := json.MarshalIndent(info, "", "\t"); err == nil { - fmt.Println(string(d)) - return nil - } - } - - fmt.Println("ERROR: read build info failed") - os.Exit(1) - - return nil - }, - } -} diff --git a/cmds/kcl-go/command/cmd_clean.go b/cmds/kcl-go/command/cmd_clean.go deleted file mode 100644 index 67e6ccb8..00000000 --- a/cmds/kcl-go/command/cmd_clean.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2021 The KCL Authors. All rights reserved. - -package command - -import ( - "fmt" - "os" - "path/filepath" - - "github.com/urfave/cli/v2" - - "kcl-lang.io/kcl-go/pkg/utils" -) - -func NewCleanCmd() *cli.Command { - return &cli.Command{ - Name: "clean", - Usage: "remove cached files", - Action: func(c *cli.Context) error { - pkgroot, err := utils.FindPkgRoot(c.Args().First()) - if err != nil { - fmt.Println("no cache found") - return err - } - cache_path := filepath.Join(pkgroot, ".kclvm/cache") - if isDir(cache_path) { - if err := os.RemoveAll(cache_path); err == nil { - fmt.Printf("%s removed\n", cache_path) - return nil - } else { - fmt.Printf("remove %s failed\n", cache_path) - return nil - } - } - - fmt.Println("no cache found") - return nil - }, - } -} - -func isDir(path string) bool { - fileInfo, err := os.Stat(path) - if err != nil { - return false - } - return fileInfo.IsDir() -} diff --git a/cmds/kcl-go/command/cmd_doc.go b/cmds/kcl-go/command/cmd_doc.go deleted file mode 100644 index 0bad89fc..00000000 --- a/cmds/kcl-go/command/cmd_doc.go +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright 2021 The KCL Authors. All rights reserved. - -package command - -import ( - "fmt" - "github.com/urfave/cli/v2" - "kcl-lang.io/kcl-go/pkg/tools/gen" -) - -const version = "v0.0.1" - -func NewDocCmd() *cli.Command { - return &cli.Command{ - Hidden: false, - Name: "doc", - Usage: "show documentation for package or symbol", - UsageText: `# Generate document for current package -kcl-go doc generate - -# Start a local KCL document server -kcl-go doc start`, - Subcommands: []*cli.Command{ - { - Name: "generate", - Usage: "generates documents from code and examples", - UsageText: `# Generate Markdown document for current package -kcl-go doc generate - -# Generate Html document for current package -kcl-go doc generate --format html - -# Generate Markdown document for specific package -kcl-go doc generate --file-path - -# Generate Markdown document for specific package to a -kcl-go doc generate --file-path --target `, - Flags: []cli.Flag{ - // todo: look for packages recursive - // todo: package path list - &cli.StringFlag{ - Name: "file-path", - Usage: `Relative or absolute path to the KCL package root when running kcl-doc command from - outside of the KCL package root directory. - If not specified, the current work directory will be used as the KCL package root.`, - }, - &cli.BoolFlag{ - Name: "ignore-deprecated", - Usage: "do not generate documentation for deprecated schemas", - Value: false, - }, - &cli.StringFlag{ - Name: "format", - Usage: "The document format to generate. Supported values: markdown, html, openapi", - Value: string(gen.Markdown), - }, - &cli.StringFlag{ - Name: "target", - Usage: "If not specified, the current work directory will be used. A docs/ folder will be created under the target directory", - }, - &cli.BoolFlag{ - Name: "escape-html", - Usage: "whether to escape html symbols when the output format is markdown. Always scape when the output format is html. Default to false", - }, - &cli.StringFlag{ - Name: "template", - Usage: "The template directory based on the KCL package root. If not specified, the built-in templates will be used.", - }, - }, - Action: func(context *cli.Context) error { - opts := gen.GenOpts{ - Path: context.String("file-path"), - IgnoreDeprecated: context.Bool("ignore-deprecated"), - Format: context.String("format"), - Target: context.String("target"), - EscapeHtml: context.Bool("escape-html"), - TemplateDir: context.String("template"), - } - - genContext, err := opts.ValidateComplete() - if err != nil { - fmt.Println(fmt.Errorf("generate failed: %s", err)) - return err - } - - err = genContext.GenDoc() - if err != nil { - fmt.Println(fmt.Errorf("generate failed: %s", err)) - return err - } else { - fmt.Println(fmt.Sprintf("Generate Complete! Check generated docs in %s", genContext.Target)) - return nil - } - }, - }, - { - Name: "start", - Usage: "starts a document website locally", - Action: func(context *cli.Context) error { - fmt.Println("not implemented") - return nil - }, - }, - }, - Flags: []cli.Flag{ - &cli.BoolFlag{ - Name: "version", - }, - }, - Action: func(c *cli.Context) error { - if c.NArg() == 0 { - cli.ShowSubcommandHelpAndExit(c, 1) - return nil - } - arg := c.Args().First() - if arg == "version" { - fmt.Println(version) - } - return nil - }, - } -} diff --git a/cmds/kcl-go/command/cmd_fmt.go b/cmds/kcl-go/command/cmd_fmt.go deleted file mode 100644 index 0395679e..00000000 --- a/cmds/kcl-go/command/cmd_fmt.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2021 The KCL Authors. All rights reserved. - -package command - -import ( - "fmt" - "os" - - "github.com/urfave/cli/v2" - - kcl "kcl-lang.io/kcl-go" -) - -func NewFmtCmd() *cli.Command { - return &cli.Command{ - Hidden: false, - Name: "fmt", - Usage: "format KCL sources", - Action: func(c *cli.Context) error { - ss, err := kcl.FormatPath(c.Args().First()) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - for _, s := range ss { - fmt.Println(s) - } - return nil - }, - } -} diff --git a/cmds/kcl-go/command/cmd_grpc_server.go b/cmds/kcl-go/command/cmd_grpc_server.go deleted file mode 100644 index d0cf5031..00000000 --- a/cmds/kcl-go/command/cmd_grpc_server.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2021 The KCL Authors. All rights reserved. - -package command - -import ( - "github.com/urfave/cli/v2" - - "kcl-lang.io/kcl-go/pkg/kclvm_runtime" - "kcl-lang.io/kcl-go/pkg/service" -) - -var cmdGrpcServerFlags = []cli.Flag{ - &cli.StringFlag{ - Name: "http", - Usage: "set listen address", - Value: ":2021", - }, - &cli.IntFlag{ - Name: "max-proc", - Aliases: []string{"n"}, - Usage: "set max kclvm process", - Value: 1, - }, -} - -func NewGrpcServerCmd() *cli.Command { - return &cli.Command{ - Hidden: false, - Name: "grpc-server", - Usage: "run grpc server", - Flags: cmdGrpcServerFlags, - Action: func(c *cli.Context) error { - kclvm_runtime.InitRuntime(c.Int("max-proc")) - return service.RunGrpcServer(c.String("http")) - }, - } -} diff --git a/cmds/kcl-go/command/cmd_lint.go b/cmds/kcl-go/command/cmd_lint.go deleted file mode 100644 index e565dd49..00000000 --- a/cmds/kcl-go/command/cmd_lint.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2021 The KCL Authors. All rights reserved. - -package command - -import ( - "fmt" - "os" - "path/filepath" - "strings" - - "github.com/urfave/cli/v2" - - kcl "kcl-lang.io/kcl-go" - "kcl-lang.io/kcl-go/pkg/kclvm_runtime" -) - -func NewLintCmd() *cli.Command { - return &cli.Command{ - Hidden: false, - Name: "lint", - Usage: "lints the KCL source files named on its command line.", - Flags: []cli.Flag{ - &cli.IntFlag{ - Name: "max-proc", - Aliases: []string{"n"}, - Usage: "set max kclvm process", - Value: 1, - }, - }, - Action: func(c *cli.Context) error { - kclvm_runtime.InitRuntime(c.Int("max-proc")) - results, err := kcl.LintPath(c.Args().Slice()) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - wd, _ := os.Getwd() - for _, s := range results { - ss := strings.Split(s, " ") - if len(ss) > 0 && filepath.IsAbs(ss[0]) && wd != "" { - if x, err := filepath.Rel(wd, ss[0]); err == nil { - ss[0] = "./" + x - } - } - fmt.Println(strings.Join(ss, " ")) - } - return nil - }, - } -} diff --git a/cmds/kcl-go/command/cmd_list.go b/cmds/kcl-go/command/cmd_list.go deleted file mode 100644 index 45a0dff1..00000000 --- a/cmds/kcl-go/command/cmd_list.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2021 The KCL Authors. All rights reserved. - -package command - -import ( - "fmt" - - "github.com/urfave/cli/v2" -) - -// list pkgs -// list pkg.Objects -// list pkg.Types -// list options -// list schema attributes - -func NewListCmd() *cli.Command { - return &cli.Command{ - Hidden: true, - Name: "list", - Usage: "list packages/names/options/attributes", - Action: func(c *cli.Context) error { - fmt.Println("TODO") - return nil - }, - } -} diff --git a/cmds/kcl-go/command/cmd_list_app.go b/cmds/kcl-go/command/cmd_list_app.go deleted file mode 100644 index aed64c8b..00000000 --- a/cmds/kcl-go/command/cmd_list_app.go +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright 2021 The KCL Authors. All rights reserved. - -package command - -import ( - "fmt" - "os" - - "github.com/urfave/cli/v2" - - "kcl-lang.io/kcl-go/pkg/tools/list" -) - -func NewLispAppCmd() *cli.Command { - return &cli.Command{ - Hidden: false, - Name: "list-app", - Usage: "list app files/packages ", - ArgsUsage: "[pkgpath]", - - Flags: []cli.Flag{ - &cli.BoolFlag{ - Name: "info", - Usage: "show root and pkgpath", - Value: true, - }, - - &cli.BoolFlag{ - Name: "file", - Usage: "list files", - Value: true, - }, - &cli.BoolFlag{ - Name: "pkg", - Usage: "list packages", - }, - - &cli.StringSliceFlag{ - Name: "changed-files", - Usage: "set changed files", - }, - - &cli.BoolFlag{ - Name: "show-abs", - Usage: "use abs path", - Value: false, - }, - &cli.BoolFlag{ - Name: "show-index", - Usage: "show index", - Value: true, - }, - - &cli.BoolFlag{ - Name: "include-all", - Usage: "include all elems", - Value: false, - }, - - &cli.StringFlag{ - Name: "kcl-yaml-file", - Usage: "set custom kcl.yaml file", - Value: "kcl.yaml", - }, - &cli.StringFlag{ - Name: "project-yaml-file", - Usage: "set custom project.yaml file", - Value: "project.yaml", - }, - &cli.BoolFlag{ - Name: "use-fast-parser", - Usage: "use fast parser only parse one app depend files", - }, - }, - - Action: func(c *cli.Context) error { - var ( - flagShowInfo = c.Bool("info") - - flagListFile = c.Bool("file") - flagListPackage = c.Bool("pkg") - - flagHasAbsPath = c.Bool("show-abs") - flagHasIndex = c.Bool("show-index") - - flagAll = c.Bool("include-all") - - flagUseFastParser = c.Bool("use-fast-parser") - ) - - pkgroot, pkgpath, err := list.FindPkgInfo(c.Args().First()) - if err != nil { - fmt.Println("ERR:", err) - os.Exit(1) - } - - var goodPath = func(i int, s string) string { - if flagHasAbsPath { - if flagHasIndex { - return fmt.Sprintf("%d: %s", i, pkgroot+"/"+s) - } else { - return pkgroot + "/" + s - } - } else { - if flagHasIndex { - return fmt.Sprintf("%d: %s", i, s) - } else { - return s - } - } - } - - if flagShowInfo { - fmt.Println("pkgroot:", pkgroot) - if pkgpath != "" { - if flagHasAbsPath { - fmt.Println("pkgpath:", pkgroot+"/"+pkgpath) - } else { - fmt.Println("pkgpath:", pkgpath) - } - } - } - - if flagUseFastParser { - depParser := list.NewSingleAppDepParser(pkgroot, list.Option{ - KclYaml: c.String("kcl-yaml-file"), - ProjectYaml: c.String("project-yaml-file"), - }) - - if flagListFile { - if pkgpath != "" { - appFiles, err := depParser.GetAppFiles(pkgpath, flagAll) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - for i, s := range appFiles { - fmt.Println(goodPath(i, s)) - } - } - } - if flagListPackage { - if pkgpath != "" { - appFiles, err := depParser.GetAppPkgs(pkgpath, flagAll) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - for i, s := range appFiles { - fmt.Println(goodPath(i, s)) - } - } - } - - return nil - } - - depParser := list.NewDepParser(pkgroot, list.Option{ - KclYaml: c.String("kcl-yaml-file"), - ProjectYaml: c.String("project-yaml-file"), - }) - if err := depParser.GetError(); err != nil { - fmt.Println(err) - os.Exit(1) - } - - if flagListFile { - if pkgpath != "" { - for i, s := range depParser.GetAppFiles(pkgpath, flagAll) { - fmt.Println(goodPath(i, s)) - } - } - } - if flagListPackage { - if pkgpath != "" { - for i, s := range depParser.GetAppPkgs(pkgpath, flagAll) { - fmt.Println(goodPath(i, s)) - } - } - } - - return nil - }, - } -} diff --git a/cmds/kcl-go/command/cmd_main.go b/cmds/kcl-go/command/cmd_main.go deleted file mode 100644 index cb7fb0e5..00000000 --- a/cmds/kcl-go/command/cmd_main.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2021 The KCL Authors. All rights reserved. - -package command - -import ( - "fmt" - "os" - "runtime/debug" - - "github.com/urfave/cli/v2" - - "kcl-lang.io/kcl-go/pkg/kclvm_runtime" - "kcl-lang.io/kcl-go/pkg/logger" -) - -func Main() { - app := cli.NewApp() - app.Name = "kcl-go" - app.Usage = "K Configuration Language Virtual Machine" - app.Version = func() string { - if info, ok := debug.ReadBuildInfo(); ok { - if info.Main.Version != "" { - return info.Main.Version - } - } - return "(devel)" - }() - - // kclvm -m kclvm - app.UsageText = `kcl-go - kcl-go [global options] command [command options] [arguments...] - - kcl-go kcl -h - kcl-go -h - - ___ __ ________ ___ - |\ \|\ \ |\ ____\|\ \ - \ \ \/ /|\ \ \___|\ \ \ - \ \ ___ \ \ \ \ \ \ - \ \ \\ \ \ \ \____\ \ \____ - \ \__\\ \__\ \_______\ \_______\ - \|__| \|__|\|_______|\|_______|` - - app.Flags = []cli.Flag{ - &cli.BoolFlag{ - Name: "debug", - Aliases: []string{"d"}, - Usage: "Run in debug mode (for developers only)", - }, - } - - app.Before = func(c *cli.Context) error { - if c.Bool("debug") { - logger.GetLogger().SetLevel("DEBUG") - fmt.Println("kclvm path:", kclvm_runtime.MustGetKclvmPath()) - } - return nil - } - - app.Commands = []*cli.Command{ - NewBuildInfoCmd(), - NewVersionCmd(), - - NewRunCmd(), - NewValidateCmd(), - NewCleanCmd(), - - NewLintCmd(), - NewFmtCmd(), - NewDocCmd(), - - NewRestServerCmd(), - - NewListCmd(), - NewLispAppCmd(), - } - - if len(os.Args) == 2 && os.Args[1] == "-gen-markdown" { - md, err := app.ToMarkdown() - if err != nil { - fmt.Println(err) - os.Exit(1) - } - - fmt.Println(md) - os.Exit(0) - } - - app.Run(os.Args) -} diff --git a/cmds/kcl-go/command/cmd_rest_server.go b/cmds/kcl-go/command/cmd_rest_server.go deleted file mode 100644 index de58044d..00000000 --- a/cmds/kcl-go/command/cmd_rest_server.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2021 The KCL Authors. All rights reserved. - -package command - -import ( - "github.com/urfave/cli/v2" - - "kcl-lang.io/kcl-go/pkg/kclvm_runtime" - "kcl-lang.io/kcl-go/pkg/service" -) - -var cmdRestServerFlags = []cli.Flag{ - &cli.StringFlag{ - Name: "http", - Usage: "set listen address", - Value: ":2021", - }, - &cli.IntFlag{ - Name: "max-proc", - Aliases: []string{"n"}, - Usage: "set max kclvm process", - Value: 1, - }, -} - -func NewRestServerCmd() *cli.Command { - return &cli.Command{ - Hidden: false, - Name: "rest-server", - Usage: "run rest server", - Flags: cmdRestServerFlags, - Action: func(c *cli.Context) error { - kclvm_runtime.InitRuntime(c.Int("max-proc")) - return service.RunRestServer(c.String("http")) - }, - } -} diff --git a/cmds/kcl-go/command/cmd_run.go b/cmds/kcl-go/command/cmd_run.go deleted file mode 100644 index 6a12e75d..00000000 --- a/cmds/kcl-go/command/cmd_run.go +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2021 The KCL Authors. All rights reserved. - -package command - -import ( - "fmt" - "os" - "strings" - - "github.com/urfave/cli/v2" - - kclvm "kcl-lang.io/kcl-go" - "kcl-lang.io/kcl-go/pkg/kcl" -) - -// keep same as kcl command -var runRunFlags = []cli.Flag{ - &cli.StringSliceFlag{ - Name: "argument", - Aliases: []string{"D"}, - Usage: "Specify the top-level argument", - }, - &cli.StringSliceFlag{ - Name: "overrides", - Aliases: []string{"O"}, - Usage: "Specify the configuration override path and value", - }, - - &cli.StringFlag{ - Name: "setting", - Aliases: []string{"Y"}, - Usage: "Specify the command line setting file", - }, - &cli.StringFlag{ - Name: "output", - Aliases: []string{"o"}, - Usage: "Specify the output file", - }, - - &cli.BoolFlag{ - Name: "disable-none", - Aliases: []string{"n"}, - Usage: "Disable dumping None values", - }, - &cli.BoolFlag{ - Name: "sort-keys", - Usage: "Sort result keys", - }, - &cli.BoolFlag{ - Name: "strict-range-check", - Aliases: []string{"r"}, - Usage: "Do perform strict numeric range check", - }, - &cli.BoolFlag{ - Name: "debug", - Aliases: []string{"d"}, - Usage: "Run in debug mode (for developers only)", - }, - &cli.StringFlag{ - Name: "output-type", - Value: "yaml", - Usage: "set output type (json|yaml)", - }, - &cli.IntFlag{ - Name: "max-proc", - Usage: "set max kclvm process", - Value: 1, - }, -} - -func NewRunCmd() *cli.Command { - return &cli.Command{ - Name: "run", - Usage: "compile and run KCL program", - ArgsUsage: "kfiles...", - Flags: runRunFlags, - Action: func(c *cli.Context) error { - if c.NArg() == 0 { - cli.ShowAppHelpAndExit(c, 0) - } - - kclvm.InitKclvmRuntime(c.Int("max-proc")) - - if c.Bool("debug") { - opt, err := kcl.ParseArgs( - c.Args().Slice(), - kcl.WithOptions(c.StringSlice("argument")...), - kcl.WithOverrides(c.StringSlice("overrides")...), - kcl.WithSettings(c.String("setting")), - ) - if err != nil { - fmt.Print(err) - os.Exit(1) - } - - fmt.Println("======== args begin ========") - fmt.Println(opt.JSONString()) - fmt.Println("======== args end ========") - } - - result, err := kcl.RunFiles( - c.Args().Slice(), - kcl.WithOptions(c.StringSlice("argument")...), - kcl.WithOverrides(c.StringSlice("overrides")...), - kcl.WithSettings(c.String("setting")), - kcl.WithSortKeys(c.Bool("sort-keys")), - ) - - if err != nil { - fmt.Print(err) - os.Exit(1) - } - - switch strings.ToLower(c.String("output-type")) { - case "json": - fmt.Println(result.GetRawJsonResult()) - - case "yaml": - fmt.Println(result.GetRawYamlResult()) - - default: - fmt.Println(result.GetRawYamlResult()) - - } - return nil - }, - } -} diff --git a/cmds/kcl-go/command/cmd_validate.go b/cmds/kcl-go/command/cmd_validate.go deleted file mode 100644 index 0f5faf32..00000000 --- a/cmds/kcl-go/command/cmd_validate.go +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2021 The KCL Authors. All rights reserved. - -package command - -import ( - "fmt" - "os" - - "github.com/urfave/cli/v2" - - "kcl-lang.io/kcl-go/pkg/kclvm_runtime" - "kcl-lang.io/kcl-go/pkg/tools/validate" -) - -var cmdValidateFlags = []cli.Flag{ - &cli.StringFlag{ - Name: "data", - Usage: "A JSON or YAML data string.", - }, - &cli.StringFlag{ - Name: "code", - Usage: "A KCL code string.", - }, - &cli.StringFlag{ - Name: "schema", - Usage: "The schema name required for verification.", - }, - &cli.StringFlag{ - Name: "attribute_name", - Usage: "The validation attribute name, default is `value`.", - }, - &cli.StringFlag{ - Name: "format", - Usage: "The data format, suppored json, JSON, yaml and YAML.", - }, - &cli.IntFlag{ - Name: "max-proc", - Aliases: []string{"n"}, - Usage: "set max kclvm process", - Value: 1, - }, -} - -func NewValidateCmd() *cli.Command { - return &cli.Command{ - Hidden: false, - Name: "vet", - Usage: "validate data match code.", - Flags: cmdValidateFlags, - Action: func(c *cli.Context) error { - data := c.String("data") - code := c.String("code") - - kclvm_runtime.InitRuntime(c.Int("max-proc")) - - ok, err := validate.ValidateCode(data, code, &validate.ValidateOptions{ - Schema: c.String("schema"), - AttributeName: c.String("attribute_name"), - Format: c.String("format"), - }) - if err != nil { - fmt.Println(err) - os.Exit(1) - } - fmt.Println(ok) - return nil - }, - } -} diff --git a/cmds/kcl-go/command/cmd_version.go b/cmds/kcl-go/command/cmd_version.go deleted file mode 100644 index e1f6b442..00000000 --- a/cmds/kcl-go/command/cmd_version.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2023 The KCL Authors. All rights reserved. - -package command - -import ( - "fmt" - "runtime" - - "github.com/urfave/cli/v2" - "kcl-lang.io/kcl-go" -) - -func NewVersionCmd() *cli.Command { - return &cli.Command{ - Hidden: false, - Name: "version", - Usage: "print version info", - Action: func(c *cli.Context) error { - fmt.Printf("%s-%s-%s\n", runtime.GOOS, runtime.GOARCH, kclvm.KclvmAbiVersion) - return nil - }, - } -} diff --git a/cmds/kcl-go/main.go b/cmds/kcl-go/main.go deleted file mode 100644 index 1474bc99..00000000 --- a/cmds/kcl-go/main.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2023 The KCL Authors. All rights reserved. - -// KCL is a declarative configuration language -// inspired by Python3 designed for Cloud-Native scenes. -package main - -import "kcl-lang.io/kcl-go/cmds/kcl-go/command" - -func main() { command.Main() }