mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
env-var
This commit is contained in:
@@ -18,6 +18,7 @@ type Single struct {
|
||||
Cpu *Cpu
|
||||
Mem *Mem
|
||||
IO *IO
|
||||
Env *Env
|
||||
X, Y int
|
||||
Width int
|
||||
}
|
||||
@@ -32,6 +33,7 @@ func NewSingle(id string) *Single {
|
||||
Cpu: NewCpu(),
|
||||
Mem: NewMem(),
|
||||
IO: NewIO(),
|
||||
Env: NewEnv(),
|
||||
Width: ui.TermWidth(),
|
||||
}
|
||||
}
|
||||
@@ -52,8 +54,14 @@ func (e *Single) Down() {
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Single) SetWidth(w int) { e.Width = w }
|
||||
func (e *Single) SetMeta(k, v string) { e.Info.Set(k, v) }
|
||||
func (e *Single) SetWidth(w int) { e.Width = w }
|
||||
func (e *Single) SetMeta(k, v string) {
|
||||
if k == "[ENV-VAR]" {
|
||||
e.Env.Set(k, v)
|
||||
} else {
|
||||
e.Info.Set(k, v)
|
||||
}
|
||||
}
|
||||
|
||||
func (e *Single) SetMetrics(m models.Metrics) {
|
||||
e.Cpu.Update(m.CPUUtil)
|
||||
@@ -69,6 +77,7 @@ func (e *Single) GetHeight() (h int) {
|
||||
h += e.Cpu.Height
|
||||
h += e.Mem.Height
|
||||
h += e.IO.Height
|
||||
h += e.Env.Height
|
||||
return h
|
||||
}
|
||||
|
||||
@@ -103,6 +112,7 @@ func (e *Single) Buffer() ui.Buffer {
|
||||
buf.Merge(e.Mem.Buffer())
|
||||
buf.Merge(e.Net.Buffer())
|
||||
buf.Merge(e.IO.Buffer())
|
||||
buf.Merge(e.Env.Buffer())
|
||||
return buf
|
||||
}
|
||||
|
||||
@@ -113,6 +123,7 @@ func (e *Single) all() []ui.GridBufferer {
|
||||
e.Mem,
|
||||
e.Net,
|
||||
e.IO,
|
||||
e.Env,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user