mirror of https://github.com/etcd-io/dbtester.git
*: add default value to 'database-id'
Fix https://github.com/coreos/dbtester/issues/312.
This commit is contained in:
parent
74de567743
commit
5173082931
|
|
@ -18,6 +18,7 @@ package control
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/coreos/dbtester"
|
||||
|
|
@ -55,7 +56,8 @@ func init() {
|
|||
break
|
||||
}
|
||||
|
||||
Command.PersistentFlags().StringVar(&databaseID, "database-id", "etcd__tip", "See dbtesterpb/database_id.pb.go")
|
||||
ids := dbtesterpb.GetAllDatabaseIDs()
|
||||
Command.PersistentFlags().StringVar(&databaseID, "database-id", ids[0], strings.Join(ids, ", "))
|
||||
Command.PersistentFlags().StringVarP(&configPath, "config", "c", "", "YAML configuration file path.")
|
||||
Command.PersistentFlags().StringVar(&diskDevice, "disk-device", dn, "Disk device to collect disk statistics metrics from.")
|
||||
Command.PersistentFlags().StringVar(&networkInterface, "network-interface", nt, "Network interface to record in/outgoing packets.")
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ package dbtesterpb
|
|||
|
||||
import (
|
||||
"image/color"
|
||||
"sort"
|
||||
|
||||
"github.com/gonum/plot/plotutil"
|
||||
)
|
||||
|
|
@ -26,6 +27,16 @@ func IsValidDatabaseID(id string) bool {
|
|||
return ok
|
||||
}
|
||||
|
||||
// GetAllDatabaseIDs returns all database ids.
|
||||
func GetAllDatabaseIDs() []string {
|
||||
var ids []string
|
||||
for k := range DatabaseID_value {
|
||||
ids = append(ids, k)
|
||||
}
|
||||
sort.Strings(ids)
|
||||
return ids
|
||||
}
|
||||
|
||||
func GetRGBI(databaseID string, i int) color.Color {
|
||||
switch databaseID {
|
||||
case "etcd__v2_3":
|
||||
|
|
|
|||
Loading…
Reference in New Issue