-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.go
36 lines (31 loc) · 786 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main
import (
"fmt"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "run",
Short: "",
Long: "",
Run: func(cmd *cobra.Command, args []string) {
target, _ := cmd.Flags().GetString("target")
duration, _ := cmd.Flags().GetInt("duration")
rps, _ := cmd.Flags().GetInt("rps")
plist, _ := cmd.Flags().GetString("plist")
executors, _ := cmd.Flags().GetInt("executors")
run(target, plist, duration, rps, executors)
},
}
func init() {
rootCmd.Flags().StringP("target", "t", "", "")
rootCmd.Flags().StringP("plist", "p", "", "")
rootCmd.Flags().IntP("duration", "d", 0, "")
rootCmd.Flags().IntP("rps", "r", 0, "")
rootCmd.Flags().IntP("executors", "e", 0, "")
}
func main() {
err := rootCmd.Execute()
if err != nil {
fmt.Println(err)
}
}