From 193b40f30ecb949caa75285a3d86cef0d44fb177 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" Date: Thu, 16 Apr 2020 09:36:10 -0500 Subject: Closes #84, cli option to scale out --- cmd/gotop/main.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go index 9971b23..5dbcd3e 100644 --- a/cmd/gotop/main.go +++ b/cmd/gotop/main.go @@ -64,6 +64,7 @@ Options: -c, --color=NAME Set a colorscheme. -h, --help Show this screen. -m, --minimal Only show CPU, Mem and Process widgets. Overrides -l. (DEPRECATED, use -l minimal) + -S, --graphscale=INT Default is 7; 1 is lowest scale-out; values greater than 30 are probably not useful. -r, --rate=RATE Number of times per second to update CPU and Mem widgets [default: 1]. -V, --version Print version and exit. -p, --percpu Show each CPU in the CPU widget. @@ -170,6 +171,19 @@ Log files are stored in %s if val, _ := args["--test"]; val != nil { conf.Test = val.(bool) } + if val, _ := args["--graphscale"]; val != nil { + str, _ := args["--graphscale"].(string) + scl, err := strconv.Atoi(str) + if err != nil { + fmt.Printf("invalid value \"%s\" for graphscale; must be an integer\n", args["--graphscale"]) + os.Exit(1) + } + if scl < 1 { + fmt.Printf("graphscale must be greater than 0 [1, ∞); you provided %d. Values > 30 are probably not useful.\n", scl) + os.Exit(1) + } + conf.GraphHorizontalScale = scl + } if args["--print-paths"].(bool) { paths := make([]string, 0) for _, d := range conf.ConfigDir.QueryFolders(configdir.All) { @@ -504,6 +518,7 @@ func run() int { http.ListenAndServe(conf.ExportPort, nil) }() } + eventLoop(conf, grid) return 0 } -- cgit v1.2.3