Skip to content

Commit e826877

Browse files
committed
fix print bug
1 parent e4e1da6 commit e826877

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cmd/root.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ var logLevel string
4242
func init() {
4343
RootCmd.PersistentFlags().StringVar(&logLevel, "logLevel", "info", "设置日志等级 (Set log level) [trace|debug|info|warn|error|fatal|panic]")
4444
RootCmd.CompletionOptions.DisableDefaultCmd = true
45+
RootCmd.SetHelpFunc(customHelpFunc)
4546
RootCmd.PersistentFlags().StringVarP(&define.File, "file", "f", "", "从文件中读取目标地址 (Input FILENAME)")
4647
RootCmd.PersistentFlags().StringVarP(&define.Url, "url", "u", "", "输入目标地址 (Input [ip|domain|url])")
4748
RootCmd.PersistentFlags().IntVarP(&define.TimeOut, "timeout", "t", 15, "输入每个 http 请求的超时时间 (Enter the timeout period for every http request)")
@@ -62,3 +63,7 @@ func Execute() {
6263
os.Exit(1)
6364
}
6465
}
66+
67+
func customHelpFunc(cmd *cobra.Command, args []string) {
68+
cmd.Usage()
69+
}

0 commit comments

Comments
 (0)