Skip to content

Commit f3e5a1d

Browse files
committed
added list of DB kind, which can be seen with ? flag
1 parent b8e2012 commit f3e5a1d

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

cmd/slowql-digest/main.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ func main() {
6868
var o options
6969
flag.StringVar(&o.logfile, "f", "", "Slow query log file to digest "+Red("(required)").String())
7070
flag.StringVar(&o.loglevel, "l", "info", "Log level")
71-
flag.StringVar(&o.kind, "k", "", "Database kind "+Red("(required)").String())
71+
flag.StringVar(&o.kind, "k", "", "Database kind. Use ? to see all the available values "+Red("(required)").String())
7272
flag.IntVar(&o.top, "top", 3, "Top queries to show")
73-
flag.StringVar(&o.order, "sort-by", "random", "How to sort queries. use ? to see all the available values")
73+
flag.StringVar(&o.order, "sort-by", "random", "How to sort queries. Use ? to see all the available values")
7474
flag.BoolVar(&o.dec, "dec", false, "Sort by decreasing order")
7575
flag.BoolVar(&o.nocache, "no-cache", false, "Do not use cache, if cache exists")
7676
flag.Parse()
@@ -83,6 +83,15 @@ func main() {
8383
return
8484
}
8585

86+
dbKinds := []string{"mysql", "mariadb"}
87+
if o.kind == "?" {
88+
fmt.Println("Available values:")
89+
for _, val := range dbKinds {
90+
fmt.Printf(" %s\n", val)
91+
}
92+
return
93+
}
94+
8695
errs := o.parse()
8796
if len(errs) != 0 {
8897
flag.Usage()

0 commit comments

Comments
 (0)