mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-22 07:11:01 +00:00
extract captions to const
This commit is contained in:
parent
278cc6c03d
commit
68c2d3ad42
2 changed files with 9 additions and 4 deletions
|
|
@ -22,6 +22,11 @@ import (
|
|||
"github.com/jesseduffield/yaml"
|
||||
)
|
||||
|
||||
const (
|
||||
CPUCaption = "CPU (%)"
|
||||
MemoryCaption = "Memory (%)"
|
||||
)
|
||||
|
||||
// UserConfig holds all of the user-configurable options
|
||||
type UserConfig struct {
|
||||
// Gui is for configuring visual things like colors and whether we show or
|
||||
|
|
@ -460,12 +465,12 @@ func GetDefaultConfig() UserConfig {
|
|||
MaxDuration: duration,
|
||||
Graphs: []GraphConfig{
|
||||
{
|
||||
Caption: "CPU (%)",
|
||||
Caption: CPUCaption,
|
||||
StatPath: "DerivedStats.CPUPercentage",
|
||||
Color: "cyan",
|
||||
},
|
||||
{
|
||||
Caption: "Memory (%)",
|
||||
Caption: MemoryCaption,
|
||||
StatPath: "DerivedStats.MemoryPercentage",
|
||||
Color: "green",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -93,14 +93,14 @@ func plotGraph(container *commands.Container, spec config.GraphConfig, width int
|
|||
memoryLimit := utils.FormatDecimalBytes(int(container.StatHistory[dataLength-1].DerivedStats.MemoryLimit))
|
||||
var caption string
|
||||
switch spec.Caption {
|
||||
case "CPU (%)":
|
||||
case config.CPUCaption:
|
||||
caption = fmt.Sprintf(
|
||||
"%s: %0.2f (%v)",
|
||||
spec.Caption,
|
||||
data[dataLength-1],
|
||||
time.Since(container.StatHistory[0].RecordedAt).Round(time.Second),
|
||||
)
|
||||
case "Memory (%)":
|
||||
case config.MemoryCaption:
|
||||
caption = fmt.Sprintf(
|
||||
"%s: %s / %s (%0.2f) (%v)",
|
||||
spec.Caption,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue