Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
()
| 62 | // Execute adds all child commands to the root command and sets flags appropriately. |
| 63 | // This is called by main.main(). It only needs to happen once to the rootCmd. |
| 64 | func Execute() { |
| 65 | initCmds() |
| 66 | |
| 67 | // Convinces glog that Parse() has been called to avoid noisy logs. |
| 68 | // https://github.com/kubernetes/kubernetes/issues/17162#issuecomment-225596212 |
| 69 | x.Check(flag.CommandLine.Parse([]string{})) |
| 70 | |
| 71 | // Dumping the usage in case of an error makes the error messages harder to see. |
| 72 | RootCmd.SilenceUsage = true |
| 73 | |
| 74 | x.CheckfNoLog(RootCmd.Execute()) |
| 75 | } |
| 76 | |
| 77 | var rootConf = viper.New() |
| 78 |