ReportToString transforms a report to a string
(report []*ReportItem)
| 152 | |
| 153 | // ReportToString transforms a report to a string |
| 154 | func ReportToString(report []*ReportItem) string { |
| 155 | reportString := "" |
| 156 | |
| 157 | if len(report) == 0 { |
| 158 | reportString += fmt.Sprintf("\n%sNo problems found.\n%sRun `%s` if you want show pod logs\n\n", paddingLeft, paddingLeft, ansi.Color("devspace logs --pick", "white+b")) |
| 159 | } else { |
| 160 | reportString += "\n" |
| 161 | |
| 162 | for _, reportItem := range report { |
| 163 | reportString += createHeader(reportItem.Name, len(reportItem.Problems)) |
| 164 | |
| 165 | for _, problem := range reportItem.Problems { |
| 166 | reportString += problem + "\n" |
| 167 | } |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | return reportString |
| 172 | } |
| 173 | |
| 174 | func createHeader(name string, problemCount int) string { |
| 175 | header := fmt.Sprintf(" %s (%d potential issue(s)) ", name, problemCount) |