From cad875a05fa006bf1ff8cee0f62e6d99f1d666b6 Mon Sep 17 00:00:00 2001 From: Cristian Dominguez Date: Thu, 18 Feb 2021 19:02:59 -0300 Subject: [PATCH] repo list: render repo tags into the 3rd column instead of the 2nd --- pkg/cmd/repo/list/list.go | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/pkg/cmd/repo/list/list.go b/pkg/cmd/repo/list/list.go index 55a713962..06c79daa2 100644 --- a/pkg/cmd/repo/list/list.go +++ b/pkg/cmd/repo/list/list.go @@ -5,7 +5,6 @@ import ( "net/http" "strings" "time" - "unicode" "github.com/cli/cli/api" "github.com/cli/cli/internal/ghinstance" @@ -153,13 +152,13 @@ func listRun(opts *ListOptions) error { if tp.IsTTY() { tp.AddField(nameWithOwner, nil, cs.Bold) - tp.AddField(info, nil, infoColor) tp.AddField(text.ReplaceExcessiveWhitespace(description), nil, nil) + tp.AddField(info, nil, infoColor) tp.AddField(utils.FuzzyAgoAbbr(now, repo.UpdatedAt), nil, nil) } else { tp.AddField(nameWithOwner, nil, nil) - tp.AddField(visibility, nil, nil) tp.AddField(text.ReplaceExcessiveWhitespace(description), nil, nil) + tp.AddField(visibility, nil, nil) tp.AddField(updatedAt, nil, nil) } tp.EndRow() @@ -196,22 +195,21 @@ type Repository struct { func (r Repository) Info() string { var info string + var tags []string if r.IsPrivate { - info = "private" + tags = append(tags, "private") } if r.IsFork { - info += " fork" + tags = append(tags, "fork") } if r.IsArchived { - info += " archived" + tags = append(tags, "archived") } - if info != "" { - info = strings.TrimPrefix(info, " ") - infoRunes := []rune(info) - infoRunes[0] = unicode.ToUpper(infoRunes[0]) - info = fmt.Sprintf("(%s)", string(infoRunes)) + if len(tags) > 0 { + tags[0] = strings.Title(tags[0]) + info = strings.Join(tags, ", ") } return info