Skip to content

Commit

Permalink
Do not print empty podman/openshift version
Browse files Browse the repository at this point in the history
  • Loading branch information
evidolob authored and praveenkumar committed Oct 13, 2022
1 parent 836bc86 commit 76d6035
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions cmd/crc/cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,29 @@ func (s *status) prettyPrintTo(writer io.Writer) error {
}
w := tabwriter.NewWriter(writer, 0, 0, 1, ' ', 0)

lines := []struct {
// todo: replace this with Pair when switching to [email protected]
type line struct {
left, right string
}{
}
lines := []line{
{"CRC VM", s.CrcStatus},
{"OpenShift", openshiftStatus(s)},
{"Podman", s.PodmanVersion},
{"Disk Usage", fmt.Sprintf(
}

if s.OpenShiftVersion != "" {
lines = append(lines, line{"OpenShift", openshiftStatus(s)})
}
if s.PodmanVersion != "" {
lines = append(lines, line{"Podman", s.PodmanVersion})
}

lines = append(lines,
line{"Disk Usage", fmt.Sprintf(
"%s of %s (Inside the CRC VM)",
units.HumanSize(float64(s.DiskUsage)),
units.HumanSize(float64(s.DiskSize)))},
{"Cache Usage", units.HumanSize(float64(s.CacheUsage))},
{"Cache Directory", s.CacheDir},
}
line{"Cache Usage", units.HumanSize(float64(s.CacheUsage))},
line{"Cache Directory", s.CacheDir})

for _, line := range lines {
if err := printLine(w, line.left, line.right); err != nil {
return err
Expand Down

0 comments on commit 76d6035

Please sign in to comment.