File tree Expand file tree Collapse file tree 1 file changed +4
-14
lines changed
Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change @@ -30,12 +30,10 @@ var RootCmd = &cobra.Command{
3030// Execute adds all child commands to the root command sets flags appropriately.
3131// This is called by main.main(). It only needs to happen once to the rootCmd.
3232func Execute () {
33- helpFunc := RootCmd .HelpFunc ()
34- RootCmd .SetHelpFunc (func (cmd * cobra.Command , args []string ) {
35- initVerbose ()
36- CheckUpdate ()
37- helpFunc (cmd , args )
38- })
33+ if ! verbose {
34+ log .SetOutput (ioutil .Discard )
35+ }
36+ CheckUpdate ()
3937 if err := RootCmd .Execute (); err != nil {
4038 fmt .Println (err )
4139 os .Exit (- 1 )
@@ -44,8 +42,6 @@ func Execute() {
4442
4543func init () {
4644 cobra .OnInitialize (initConfig )
47- cobra .OnInitialize (initVerbose )
48- cobra .OnInitialize (CheckUpdate )
4945
5046 // Here you will define your flags and configuration settings.
5147 // Cobra supports Persistent Flags, which, if defined here,
@@ -81,9 +77,3 @@ func initConfig() {
8177 fmt .Println ("Using config file:" , viper .ConfigFileUsed ())
8278 }
8379}
84-
85- func initVerbose () {
86- if ! verbose {
87- log .SetOutput (ioutil .Discard )
88- }
89- }
You can’t perform that action at this time.
0 commit comments