Skip to content

Commit

Permalink
Make template more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
Allison Richardet committed Dec 2, 2016
1 parent 05a2d78 commit decedd3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion prettyprinters/human/human.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,20 @@ func (p *Printer) StartPP(g *graph.Graph) (pp.Renderable, error) {

// FinishPP provides summary statistics about the printed graph
func (p *Printer) FinishPP(g *graph.Graph) (pp.Renderable, error) {
tmpl, err := p.template("{{if .Errors}}Errors:\n{{range .Errors}} * {{.}}\n{{end}}\n{{end}}{{if .DependencyErrors}}Failed due to failing dependency:\n{{range .DependencyErrors}} * {{.}}\n{{end}}\n{{end}}{{if gt (len .Errors) 0}}{{red \"Summary\"}}{{else}}{{green \"Summary\"}}{{end}}: {{len .Errors}} errors, {{.ChangesCount}} changes{{if .DependencyErrors}}, {{len .DependencyErrors}} dependency errors{{end}}\n")
tmpl, err := p.template(`{{if .Errors}}Errors:
{{range .Errors}} * {{.}}
{{end}}
{{end}}
{{- if .DependencyErrors}}Failed due to failing dependency:
{{range .DependencyErrors}} * {{.}}
{{end}}
{{end}}
{{- if gt (len .Errors) 0}}{{red "Summary"}}
{{- else}}{{green "Summary"}}
{{- end}}: {{len .Errors}} errors, {{.ChangesCount}} changes
{{- if .DependencyErrors}}, {{len .DependencyErrors}} dependency errors
{{- end}}
`)
if err != nil {
return pp.HiddenString(), err
}
Expand Down

0 comments on commit decedd3

Please sign in to comment.