formatTree renders results in tree structure
(group map[string]map[string]*baseline.Baseline, opts Option)
| 185 | |
| 186 | // formatTree renders results in tree structure |
| 187 | func formatTree(group map[string]map[string]*baseline.Baseline, opts Option) { |
| 188 | // Sort host:port for consistent output |
| 189 | var hosts []string |
| 190 | for host := range group { |
| 191 | hosts = append(hosts, host) |
| 192 | } |
| 193 | sort.Strings(hosts) |
| 194 | |
| 195 | for _, host := range hosts { |
| 196 | results := group[host] |
| 197 | |
| 198 | // Build tree for this host |
| 199 | root := NewTreeNode("") |
| 200 | for path, result := range results { |
| 201 | if !opts.Fuzzy && result.IsFuzzy { |
| 202 | continue |
| 203 | } |
| 204 | |
| 205 | // Split path into parts |
| 206 | parts := strings.Split(strings.Trim(path, "/"), "/") |
| 207 | if path == "/" { |
| 208 | parts = []string{"/"} |
| 209 | } |
| 210 | |
| 211 | root.AddPath(parts, result) |
| 212 | } |
| 213 | |
| 214 | // Print host header |
| 215 | logs.Log.Console(fmt.Sprintf("\n%s\n", host)) |
| 216 | |
| 217 | // Render tree |
| 218 | logs.Log.Console(root.RenderTree("", true, !opts.NoColor)) |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | // formatFull renders results in full/original format |
| 223 | func formatFull(group map[string]map[string]*baseline.Baseline, opts Option) { |
no test coverage detected