Skip to content

Commit

Permalink
Closes #84, cli option to scale out
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxserxxx committed Apr 16, 2020
1 parent 71ec32f commit 193b40f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/gotop/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -504,6 +518,7 @@ func run() int {
http.ListenAndServe(conf.ExportPort, nil)
}()
}

eventLoop(conf, grid)
return 0
}
Expand Down

0 comments on commit 193b40f

Please sign in to comment.