Skip to content

Commit

Permalink
compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleFall committed Aug 11, 2021
1 parent 35d2814 commit cb4257b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion components/playground/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ var (

const (
mode = "mode"
withoutMonitor = "no-monitor"
withMonitor = "monitor"
withoutMonitor = "without-monitor"

// instance numbers
db = "db"
Expand Down Expand Up @@ -297,6 +298,9 @@ If you'd like to use a TiDB version other than %s, cancel and retry with the fol

rootCmd.Flags().String(mode, defaultMode, "TiUP playground mode: 'tidb', 'tikv-slim'")
rootCmd.Flags().Bool(withoutMonitor, false, "Don't start prometheus and grafana component")
rootCmd.Flags().Bool(withMonitor, true, "Start prometheus and grafana component")
_ = rootCmd.Flags().MarkHidden(withMonitor)
_ = rootCmd.Flags().MarkDeprecated(withMonitor, "Please use --without-monitor to control whether to disable monitor.")

rootCmd.Flags().Int(db, defaultOptions.TiDB.Num, "TiDB instance number")
rootCmd.Flags().Int(kv, defaultOptions.TiKV.Num, "TiKV instance number")
Expand Down Expand Up @@ -364,6 +368,11 @@ func populateOpt(flagSet *pflag.FlagSet) (err error) {

flagSet.Visit(func(flag *pflag.Flag) {
switch flag.Name {
case withMonitor:
options.Monitor, err = strconv.ParseBool(flag.Value.String())
if err != nil {
return
}
case withoutMonitor:
options.Monitor, err = strconv.ParseBool(flag.Value.String())
if err != nil {
Expand Down

0 comments on commit cb4257b

Please sign in to comment.