Use cobra (#234)

switch to cobra

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2022-07-19 21:06:18 +09:00
committed by GitHub
parent 35453566df
commit 85ade797ab
44 changed files with 2144 additions and 831 deletions
+14 -4
View File
@@ -5,13 +5,23 @@ import (
"os"
"github.com/helmfile/helmfile/cmd"
"github.com/helmfile/helmfile/pkg/config"
"github.com/urfave/cli"
)
func warning(format string, v ...interface{}) {
format = fmt.Sprintf("WARNING: %s\n", format)
fmt.Fprintf(os.Stderr, format, v...)
}
func main() {
rootCmd := cmd.RootCommand()
err := rootCmd.Run(os.Args)
globalConfig := new(config.GlobalOptions)
rootCmd, err := cmd.NewRootCmd(globalConfig, os.Args[1:])
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(3)
warning("%+v", err)
os.Exit(1)
}
if err := rootCmd.Execute(); err != nil {
cli.HandleExitCoder(err)
}
}