Skip to content

Commit

Permalink
added list of DB kind, which can be seen with ? flag
Browse files Browse the repository at this point in the history
  • Loading branch information
eze-kiel committed Apr 20, 2021
1 parent b8e2012 commit f3e5a1d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cmd/slowql-digest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ func main() {
var o options
flag.StringVar(&o.logfile, "f", "", "Slow query log file to digest "+Red("(required)").String())
flag.StringVar(&o.loglevel, "l", "info", "Log level")
flag.StringVar(&o.kind, "k", "", "Database kind "+Red("(required)").String())
flag.StringVar(&o.kind, "k", "", "Database kind. Use ? to see all the available values "+Red("(required)").String())
flag.IntVar(&o.top, "top", 3, "Top queries to show")
flag.StringVar(&o.order, "sort-by", "random", "How to sort queries. use ? to see all the available values")
flag.StringVar(&o.order, "sort-by", "random", "How to sort queries. Use ? to see all the available values")
flag.BoolVar(&o.dec, "dec", false, "Sort by decreasing order")
flag.BoolVar(&o.nocache, "no-cache", false, "Do not use cache, if cache exists")
flag.Parse()
Expand All @@ -83,6 +83,15 @@ func main() {
return
}

dbKinds := []string{"mysql", "mariadb"}
if o.kind == "?" {
fmt.Println("Available values:")
for _, val := range dbKinds {
fmt.Printf(" %s\n", val)
}
return
}

errs := o.parse()
if len(errs) != 0 {
flag.Usage()
Expand Down

0 comments on commit f3e5a1d

Please sign in to comment.