mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-26 01:22:51 +00:00
feat: Silence logs (#2538)
Signed-off-by: joyceliu <joyceliu@yunify.com>
This commit is contained in:
parent
2dead130da
commit
dc8717479b
|
|
@ -50,6 +50,7 @@ func NewRootCommand() *cobra.Command {
|
|||
PersistentPostRunE: func(*cobra.Command, []string) error {
|
||||
return options.FlushProfiling()
|
||||
},
|
||||
SilenceUsage: true,
|
||||
}
|
||||
cmd.SetContext(signals.SetupSignalHandler())
|
||||
// add common flag
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
|
|
@ -25,7 +26,12 @@ import (
|
|||
|
||||
func main() {
|
||||
if err := app.NewRootCommand().Execute(); err != nil {
|
||||
fmt.Printf("%+v", err)
|
||||
vFlag := flag.Lookup("v")
|
||||
if vFlag != nil {
|
||||
fmt.Printf("%+v", err)
|
||||
} else {
|
||||
fmt.Printf("%v", err)
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue