Skip to content

Commit

Permalink
fix broken format of showing disks in non-interactive mode
Browse files Browse the repository at this point in the history
closes #23
  • Loading branch information
dundee committed Jan 25, 2021
1 parent d75ca21 commit 973a252
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions stdout/stdout.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,27 @@ func (ui *UI) ListDevices(getter analyze.DevicesInfoGetter) {
func(device *analyze.Device) string { return device.Name },
), len("Devices"))

lineFormat := fmt.Sprintf("%%%ds %%9s %%9s %%9s %%5s %%s\n", maxDeviceNameLenght)
var sizeLength, percentLength int
if ui.useColors {
sizeLength = 20
percentLength = 8
} else {
sizeLength = 9
percentLength = 5
}

lineFormat := fmt.Sprintf(
"%%%ds %%%ds %%%ds %%%ds %%%ds %%s\n",
maxDeviceNameLenght,
sizeLength,
sizeLength,
sizeLength,
percentLength,
)

fmt.Fprintf(
ui.output,
lineFormat,
fmt.Sprintf("%%%ds %%9s %%9s %%9s %%5s %%s\n", maxDeviceNameLenght),
"Device",
"Size",
"Used",
Expand Down

0 comments on commit 973a252

Please sign in to comment.