cmd/geth: limit the maximum chart colums to 6

This commit is contained in:
Péter Szilágyi 2015-06-25 12:12:11 +03:00
parent 3ea6b5ae32
commit c6e2af14c0

View File

@ -85,7 +85,9 @@ func monitor(ctx *cli.Context) {
utils.Fatalf("No metrics specified.\n\nAvailable:\n - %s", strings.Join(list, "\n - ")) utils.Fatalf("No metrics specified.\n\nAvailable:\n - %s", strings.Join(list, "\n - "))
} }
sort.Strings(monitored) sort.Strings(monitored)
if cols := len(monitored) / ctx.Int(monitorCommandRowsFlag.Name); cols > 6 {
utils.Fatalf("Requested metrics (%d) spans more that 6 columns:\n - %s", len(monitored), strings.Join(monitored, "\n - "))
}
// Create and configure the chart UI defaults // Create and configure the chart UI defaults
if err := termui.Init(); err != nil { if err := termui.Init(); err != nil {
utils.Fatalf("Unable to initialize terminal UI: %v", err) utils.Fatalf("Unable to initialize terminal UI: %v", err)