6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-04 23:49:42 +00:00

Indicate if error occured during status loading and print the list of errors

This commit is contained in:
Grzegorz Dlugoszewski
2020-07-27 16:17:13 +02:00
parent d660a73c7f
commit b2d1d773f7
7 changed files with 107 additions and 59 deletions

View File

@@ -18,8 +18,14 @@ func NewFlatPrinter() *FlatPrinter {
func (p *FlatPrinter) Print(repos []Printable) string {
var str strings.Builder
for i, r := range repos {
for _, r := range repos {
str.WriteString(strings.TrimSuffix(r.Path(), string(os.PathSeparator)))
if len(r.Errors()) > 0 {
str.WriteString(" " + red("error") + "\n")
continue
}
str.WriteString(" " + blue(r.Current()))
current := r.BranchStatus(r.Current())
@@ -45,10 +51,8 @@ func (p *FlatPrinter) Print(repos []Printable) string {
str.WriteString(fmt.Sprintf("\n%s %s %s", indent, blue(branch), yellow(status)))
}
if i < len(repos)-1 {
str.WriteString("\n")
}
str.WriteString("\n")
}
return str.String()
return str.String() + Errors(repos)
}