mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
Simplified code a bit
This commit is contained in:
parent
857053de56
commit
78d7fda9ec
3 changed files with 7 additions and 11 deletions
|
|
@ -225,20 +225,16 @@ func (c *Container) PlotGraph(spec config.GraphConfig, width int) (string, error
|
||||||
if spec.MinType == "" {
|
if spec.MinType == "" {
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
min = floatValue
|
min = floatValue
|
||||||
} else {
|
} else if floatValue < min {
|
||||||
if floatValue < min {
|
min = floatValue
|
||||||
min = floatValue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if spec.MaxType == "" {
|
if spec.MaxType == "" {
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
max = floatValue
|
max = floatValue
|
||||||
} else {
|
} else if floatValue > max {
|
||||||
if floatValue > max {
|
max = floatValue
|
||||||
max = floatValue
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import (
|
||||||
func (gui *Gui) GetColor(keys []string) gocui.Attribute {
|
func (gui *Gui) GetColor(keys []string) gocui.Attribute {
|
||||||
var attribute gocui.Attribute
|
var attribute gocui.Attribute
|
||||||
for _, key := range keys {
|
for _, key := range keys {
|
||||||
attribute = attribute | utils.GetGocuiAttribute(key)
|
attribute |= utils.GetGocuiAttribute(key)
|
||||||
}
|
}
|
||||||
return attribute
|
return attribute
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ func FormatBinaryBytes(b int) string {
|
||||||
units := []string{"B", "kiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"}
|
units := []string{"B", "kiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"}
|
||||||
for _, unit := range units {
|
for _, unit := range units {
|
||||||
if n > math.Pow(2, 10) {
|
if n > math.Pow(2, 10) {
|
||||||
n = n / math.Pow(2, 10)
|
n /= math.Pow(2, 10)
|
||||||
} else {
|
} else {
|
||||||
val := fmt.Sprintf("%.2f%s", n, unit)
|
val := fmt.Sprintf("%.2f%s", n, unit)
|
||||||
if val == "0.00B" {
|
if val == "0.00B" {
|
||||||
|
|
@ -244,7 +244,7 @@ func FormatDecimalBytes(b int) string {
|
||||||
units := []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"}
|
units := []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"}
|
||||||
for _, unit := range units {
|
for _, unit := range units {
|
||||||
if n > math.Pow(10, 3) {
|
if n > math.Pow(10, 3) {
|
||||||
n = n / math.Pow(10, 3)
|
n /= math.Pow(10, 3)
|
||||||
} else {
|
} else {
|
||||||
val := fmt.Sprintf("%.2f%s", n, unit)
|
val := fmt.Sprintf("%.2f%s", n, unit)
|
||||||
if val == "0.00B" {
|
if val == "0.00B" {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue