diff --git a/cmd/kcl/commands/root.go b/cmd/kcl/commands/root.go index cb608fe..5c0f7b5 100644 --- a/cmd/kcl/commands/root.go +++ b/cmd/kcl/commands/root.go @@ -97,11 +97,12 @@ scenarios. The KCL website: https://kcl-lang.io // New creates a new cobra client func New() *cobra.Command { cmd := &cobra.Command{ - Use: cmdName, - Short: "The KCL Command Line Interface (CLI).", - Long: rootDesc, - SilenceUsage: true, - Version: version.GetVersionString(), + Use: cmdName, + Short: "The KCL Command Line Interface (CLI).", + Long: rootDesc, + SilenceUsage: true, + SilenceErrors: true, + Version: version.GetVersionString(), } // Language commands cmd.AddCommand(NewRunCmd()) diff --git a/cmd/kcl/main.go b/cmd/kcl/main.go index e8d3828..739af52 100644 --- a/cmd/kcl/main.go +++ b/cmd/kcl/main.go @@ -3,13 +3,16 @@ package main import ( + "fmt" "os" + "strings" - "kcl-lang.io/cli/cmd/kcl/commands" + cmd "kcl-lang.io/cli/cmd/kcl/commands" ) func main() { if err := cmd.New().Execute(); err != nil { + fmt.Fprintln(os.Stderr, strings.TrimLeft(err.Error(), "\n")) os.Exit(1) } }