Remove labels from the issue preview header

See https://github.com/cli/cli/issues/652#issuecomment-598940740
This commit is contained in:
Toshiya Doi 2020-03-18 04:42:50 +09:00
parent 9a6026e9fc
commit e85259d84f
2 changed files with 4 additions and 13 deletions

View file

@ -254,26 +254,17 @@ func IssueStateTitleWithColor(state string) string {
}
func printIssuePreview(out io.Writer, issue *api.Issue) error {
coloredLabels := labelList(*issue)
if coloredLabels != "" {
coloredLabels = fmt.Sprintf("%s", coloredLabels)
}
now := time.Now()
ago := now.Sub(issue.CreatedAt)
fmt.Fprintln(out, utils.Bold(issue.Title))
fmt.Fprintf(out, "%s", IssueStateTitleWithColor(issue.State))
fmt.Fprint(out, utils.Gray(fmt.Sprintf(
fmt.Fprintln(out, utils.Gray(fmt.Sprintf(
" • %s opened %s • %s",
issue.Author.Login,
utils.FuzzyAgo(ago),
utils.Pluralize(issue.Comments.TotalCount, "comment"),
)))
if coloredLabels != "" {
fmt.Fprintf(out, utils.Gray(fmt.Sprintf(" • %s", coloredLabels)))
}
fmt.Fprintf(out, "\n")
if issue.Body != "" {
fmt.Fprintln(out)

View file

@ -297,7 +297,7 @@ func TestIssueView_preview(t *testing.T) {
expectedLines := []*regexp.Regexp{
regexp.MustCompile(`ix of coins`),
regexp.MustCompile(`Open • marseilles opened about 292 years ago • 9 comments • tarot`),
regexp.MustCompile(`Open • marseilles opened about 292 years ago • 9 comments`),
regexp.MustCompile(`bold story`),
regexp.MustCompile(`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`),
}
@ -357,7 +357,7 @@ func TestIssueView_previewClosedState(t *testing.T) {
expectedLines := []*regexp.Regexp{
regexp.MustCompile(`ix of coins`),
regexp.MustCompile(`Closed • marseilles opened about 292 years ago • 9 comments • tarot`),
regexp.MustCompile(`Closed • marseilles opened about 292 years ago • 9 comments`),
regexp.MustCompile(`bold story`),
regexp.MustCompile(`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`),
}
@ -387,7 +387,7 @@ func TestIssueView_previewWithEmptyBody(t *testing.T) {
expectedLines := []*regexp.Regexp{
regexp.MustCompile(`ix of coins`),
regexp.MustCompile(`Open • marseilles opened about 292 years ago • 9 comments • tarot`),
regexp.MustCompile(`Open • marseilles opened about 292 years ago • 9 comments`),
regexp.MustCompile(`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`),
}
for _, r := range expectedLines {