mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-19 11:07:24 +02:00
Use cobra (#234)
switch to cobra Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user