mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-21 23:01: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 i == 0 {
|
||||
min = floatValue
|
||||
} else {
|
||||
if floatValue < min {
|
||||
min = floatValue
|
||||
}
|
||||
} else if floatValue < min {
|
||||
min = floatValue
|
||||
}
|
||||
}
|
||||
|
||||
if spec.MaxType == "" {
|
||||
if i == 0 {
|
||||
max = floatValue
|
||||
} else {
|
||||
if floatValue > max {
|
||||
max = floatValue
|
||||
}
|
||||
} else if floatValue > max {
|
||||
max = floatValue
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
func (gui *Gui) GetColor(keys []string) gocui.Attribute {
|
||||
var attribute gocui.Attribute
|
||||
for _, key := range keys {
|
||||
attribute = attribute | utils.GetGocuiAttribute(key)
|
||||
attribute |= utils.GetGocuiAttribute(key)
|
||||
}
|
||||
return attribute
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ func FormatBinaryBytes(b int) string {
|
|||
units := []string{"B", "kiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"}
|
||||
for _, unit := range units {
|
||||
if n > math.Pow(2, 10) {
|
||||
n = n / math.Pow(2, 10)
|
||||
n /= math.Pow(2, 10)
|
||||
} else {
|
||||
val := fmt.Sprintf("%.2f%s", n, unit)
|
||||
if val == "0.00B" {
|
||||
|
|
@ -244,7 +244,7 @@ func FormatDecimalBytes(b int) string {
|
|||
units := []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"}
|
||||
for _, unit := range units {
|
||||
if n > math.Pow(10, 3) {
|
||||
n = n / math.Pow(10, 3)
|
||||
n /= math.Pow(10, 3)
|
||||
} else {
|
||||
val := fmt.Sprintf("%.2f%s", n, unit)
|
||||
if val == "0.00B" {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue