"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/cmd/issue/shared/display.go" between
gh-cli-1.12.1.tar.gz and gh-cli-1.13.1.tar.gz

About: GitHub CLI is GitHub’s official command line tool.

display.go  (gh-cli-1.12.1):display.go  (gh-cli-1.13.1)
skipping to change at line 25 skipping to change at line 25
func PrintIssues(io *iostreams.IOStreams, prefix string, totalCount int, issues []api.Issue) { func PrintIssues(io *iostreams.IOStreams, prefix string, totalCount int, issues []api.Issue) {
cs := io.ColorScheme() cs := io.ColorScheme()
table := utils.NewTablePrinter(io) table := utils.NewTablePrinter(io)
for _, issue := range issues { for _, issue := range issues {
issueNum := strconv.Itoa(issue.Number) issueNum := strconv.Itoa(issue.Number)
if table.IsTTY() { if table.IsTTY() {
issueNum = "#" + issueNum issueNum = "#" + issueNum
} }
issueNum = prefix + issueNum issueNum = prefix + issueNum
labels := IssueLabelList(issue) labels := IssueLabelList(issue, cs)
if labels != "" && table.IsTTY() { if labels != "" && table.IsTTY() {
labels = fmt.Sprintf("(%s)", labels) labels = fmt.Sprintf("(%s)", labels)
} }
now := time.Now() now := time.Now()
ago := now.Sub(issue.UpdatedAt) ago := now.Sub(issue.UpdatedAt)
table.AddField(issueNum, nil, cs.ColorFromString(prShared.ColorFo rState(issue.State))) table.AddField(issueNum, nil, cs.ColorFromString(prShared.ColorFo rState(issue.State)))
if !table.IsTTY() { if !table.IsTTY() {
table.AddField(issue.State, nil, nil) table.AddField(issue.State, nil, nil)
} }
table.AddField(text.ReplaceExcessiveWhitespace(issue.Title), nil, nil) table.AddField(text.ReplaceExcessiveWhitespace(issue.Title), nil, nil)
skipping to change at line 59 skipping to change at line 59
} }
func truncateLabels(w int, t string) string { func truncateLabels(w int, t string) string {
if len(t) < 2 { if len(t) < 2 {
return t return t
} }
truncated := text.Truncate(w-2, t[1:len(t)-1]) truncated := text.Truncate(w-2, t[1:len(t)-1])
return fmt.Sprintf("(%s)", truncated) return fmt.Sprintf("(%s)", truncated)
} }
func IssueLabelList(issue api.Issue) string { func IssueLabelList(issue api.Issue, cs *iostreams.ColorScheme) string {
if len(issue.Labels.Nodes) == 0 { if len(issue.Labels.Nodes) == 0 {
return "" return ""
} }
labelNames := make([]string, 0, len(issue.Labels.Nodes)) labelNames := make([]string, 0, len(issue.Labels.Nodes))
for _, label := range issue.Labels.Nodes { for _, label := range issue.Labels.Nodes {
labelNames = append(labelNames, label.Name) labelNames = append(labelNames, cs.HexToRGB(label.Color, label.Na me))
} }
return strings.Join(labelNames, ", ") return strings.Join(labelNames, ", ")
} }
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)