|
| 1 | +// #### Language & Tooling Commands |
| 2 | +// |
| 3 | +// ``` |
| 4 | +// kcl |
| 5 | +// |
| 6 | +// run compile kcl package from a url or filepath |
| 7 | +// build build the kcl package |
| 8 | +// check check the current package, but don't build target files |
| 9 | +// doc documentation tool |
| 10 | +// fmt format tool |
| 11 | +// lint lint tool |
| 12 | +// test unit/integration/benchmark test tool |
| 13 | +// lsp language server tool |
| 14 | +// clean remove object files and cached files |
| 15 | +// |
| 16 | +// ``` |
| 17 | +// |
| 18 | +// #### Package & Registry Related Commands (mod and registry workspace) |
| 19 | +// |
| 20 | +// ``` |
| 21 | +// kcl |
| 22 | +// |
| 23 | +// mod init initialize new module in current directory |
| 24 | +// mod search search a command from regisry |
| 25 | +// mod add add new dependency |
| 26 | +// mod remove remove dependency |
| 27 | +// mod update update dependency |
| 28 | +// mod pkg package a kcl package into tar |
| 29 | +// mod metadata output the resolved dependencies of a package |
| 30 | +// mod push push kcl package to OCI registry. |
| 31 | +// mod pull pull kcl package from OCI registry. |
| 32 | +// registry login login to a registry |
| 33 | +// registry logout logout from a registry |
| 34 | +// |
| 35 | +// ``` |
| 36 | +// |
| 37 | +// #### Integration Commands |
| 38 | +// |
| 39 | +// ``` |
| 40 | +// kcl |
| 41 | +// |
| 42 | +// import migration other data and schema to kcl e.g., openapi, jsonschema, json, yaml |
| 43 | +// export convert kcl schema to other schema e.g., openapi |
| 44 | +// |
| 45 | +// ``` |
| 46 | +// |
| 47 | +// #### Plugin Commands (plugin workspace) |
| 48 | +// |
| 49 | +// ``` |
| 50 | +// kcl |
| 51 | +// |
| 52 | +// plugin install install one or more kcl command plugins |
| 53 | +// plugin list list installed command plugins |
| 54 | +// plugin uninstall uninstall one or more command plugins |
| 55 | +// plugin update update one or more command plugins |
| 56 | +// |
| 57 | +// ``` |
| 58 | +// |
| 59 | +// #### Version and Help Commands |
| 60 | +// |
| 61 | +// ``` |
| 62 | +// kcl |
| 63 | +// |
| 64 | +// help, h Shows a list of commands or help for one command |
| 65 | +// version Shows the command version |
| 66 | +// |
| 67 | +// ``` |
| 68 | +package cmd |
| 69 | + |
| 70 | +import ( |
| 71 | + "github.com/spf13/cobra" |
| 72 | +) |
| 73 | + |
| 74 | +const rootCmdShortUsage = "The KCL Command Line Interface (CLI)." |
| 75 | +const rootCmdLongUsage = `The KCL Command Line Interface (CLI). |
| 76 | +
|
| 77 | +KCL is an open-source, constraint-based record and functional language that |
| 78 | +enhances the writing of complex configurations, including those for cloud-native |
| 79 | +scenarios. The KCL website: https://kcl-lang.io |
| 80 | +` |
| 81 | + |
| 82 | +// New creates a new cobra client |
| 83 | +func New() *cobra.Command { |
| 84 | + cmd := &cobra.Command{ |
| 85 | + Use: "kcl", |
| 86 | + Short: rootCmdShortUsage, |
| 87 | + Long: rootCmdLongUsage, |
| 88 | + SilenceUsage: true, |
| 89 | + } |
| 90 | + cmd.AddCommand(NewVersionCmd()) |
| 91 | + cmd.AddCommand(NewRunCmd()) |
| 92 | + cmd.SetHelpCommand(&cobra.Command{}) // Disable the help command |
| 93 | + return cmd |
| 94 | +} |
0 commit comments