Added minimal mode; Closes #4
This commit is contained in:
parent
6c3602aba3
commit
479491298e
15
gotop.go
15
gotop.go
|
@ -28,6 +28,8 @@ var (
|
||||||
|
|
||||||
colorscheme = colorschemes.Default
|
colorscheme = colorschemes.Default
|
||||||
|
|
||||||
|
minimal = false
|
||||||
|
|
||||||
cpu *w.CPU
|
cpu *w.CPU
|
||||||
mem *w.Mem
|
mem *w.Mem
|
||||||
proc *w.Proc
|
proc *w.Proc
|
||||||
|
@ -45,6 +47,7 @@ Usage: gotop [options]
|
||||||
Options:
|
Options:
|
||||||
-c, --color <name> Set a colorscheme.
|
-c, --color <name> Set a colorscheme.
|
||||||
-h, --help Show this screen.
|
-h, --help Show this screen.
|
||||||
|
-m, --minimal Only show CPU, Mem and Process widgets.
|
||||||
-v, --version Show version.
|
-v, --version Show version.
|
||||||
|
|
||||||
Colorschemes:
|
Colorschemes:
|
||||||
|
@ -58,6 +61,8 @@ Colorschemes:
|
||||||
if val, _ := args["--color"]; val != nil {
|
if val, _ := args["--color"]; val != nil {
|
||||||
handleColorscheme(val.(string))
|
handleColorscheme(val.(string))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
minimal, _ = args["--minimal"].(bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleColorscheme(cs string) {
|
func handleColorscheme(cs string) {
|
||||||
|
@ -78,6 +83,11 @@ func setupGrid() {
|
||||||
ui.Body.Cols = 12
|
ui.Body.Cols = 12
|
||||||
ui.Body.Rows = 12
|
ui.Body.Rows = 12
|
||||||
|
|
||||||
|
if minimal {
|
||||||
|
ui.Body.Set(0, 0, 12, 6, cpu)
|
||||||
|
ui.Body.Set(0, 6, 6, 12, mem)
|
||||||
|
ui.Body.Set(6, 6, 12, 12, proc)
|
||||||
|
} else {
|
||||||
ui.Body.Set(0, 0, 12, 4, cpu)
|
ui.Body.Set(0, 0, 12, 4, cpu)
|
||||||
|
|
||||||
ui.Body.Set(0, 4, 4, 6, disk)
|
ui.Body.Set(0, 4, 4, 6, disk)
|
||||||
|
@ -87,6 +97,7 @@ func setupGrid() {
|
||||||
ui.Body.Set(0, 8, 6, 12, net)
|
ui.Body.Set(0, 8, 6, 12, net)
|
||||||
ui.Body.Set(6, 8, 12, 12, proc)
|
ui.Body.Set(6, 8, 12, 12, proc)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func keyBinds() {
|
func keyBinds() {
|
||||||
// quits
|
// quits
|
||||||
|
@ -131,9 +142,11 @@ func widgetColors() {
|
||||||
}
|
}
|
||||||
cpu.LineColor = LineColor
|
cpu.LineColor = LineColor
|
||||||
|
|
||||||
|
if !minimal {
|
||||||
temp.TempLow = ui.Color(colorscheme.TempLow)
|
temp.TempLow = ui.Color(colorscheme.TempLow)
|
||||||
temp.TempHigh = ui.Color(colorscheme.TempHigh)
|
temp.TempHigh = ui.Color(colorscheme.TempHigh)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
cliArguments()
|
cliArguments()
|
||||||
|
@ -146,9 +159,11 @@ func main() {
|
||||||
cpu = w.NewCPU()
|
cpu = w.NewCPU()
|
||||||
mem = w.NewMem()
|
mem = w.NewMem()
|
||||||
proc = w.NewProc(procLoaded, keyPressed)
|
proc = w.NewProc(procLoaded, keyPressed)
|
||||||
|
if !minimal {
|
||||||
net = w.NewNet()
|
net = w.NewNet()
|
||||||
disk = w.NewDisk()
|
disk = w.NewDisk()
|
||||||
temp = w.NewTemp()
|
temp = w.NewTemp()
|
||||||
|
}
|
||||||
|
|
||||||
widgetColors()
|
widgetColors()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user