cleanup debug logs & remove duplicated output (#1348)

* cleanup debug logs

* avoid duplicate error messages

and this makes main.go use os and fmt package instead of log to avoid
touching global state
This commit is contained in:
namusyaka
2020-11-04 22:50:18 +08:00
committed by GitHub
parent 8b06045c70
commit 951b46e3c2
3 changed files with 8 additions and 11 deletions
+4 -5
View File
@@ -49,14 +49,14 @@ var (
// RootCmd root level flags and commands
var RootCmd = &cobra.Command{
Use: "kompose",
Short: "A tool helping Docker Compose users move to Kubernetes",
Long: `Kompose is a tool to help users who are familiar with docker-compose move to Kubernetes.`,
Use: "kompose",
Short: "A tool helping Docker Compose users move to Kubernetes",
Long: `Kompose is a tool to help users who are familiar with docker-compose move to Kubernetes.`,
SilenceErrors: true,
// PersistentPreRun will be "inherited" by all children and ran before *every* command unless
// the child has overridden the functionality. This functionality was implemented to check / modify
// all global flag calls regardless of app call.
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// Add extra logging when verbosity is passed
if GlobalVerbose {
log.SetLevel(log.DebugLevel)
@@ -81,7 +81,6 @@ var RootCmd = &cobra.Command{
if provider != "kubernetes" && provider != "openshift" {
log.Fatalf("%s is an unsupported provider. Supported providers are: 'kubernetes', 'openshift'.", GlobalProvider)
}
},
}