diff options
author | Christian Muehlhaeuser <muesli@gmail.com> | 2021-09-06 20:26:40 +0200 |
---|---|---|
committer | Christian Muehlhaeuser <muesli@gmail.com> | 2021-09-06 20:36:11 +0200 |
commit | b941c9353358c45846a86c1462a620be83060ef8 (patch) | |
tree | 5e1b1aa854b92bec26d5d0621f56a3de52cb5139 | |
parent | 416cffb79748c40e0f1e5d501cba75beb65bee0e (diff) |
Truncate strings with an ellipsis
-rw-r--r-- | branch.go | 2 | ||||
-rw-r--r-- | commit.go | 2 | ||||
-rw-r--r-- | issue.go | 2 | ||||
-rw-r--r-- | pr.go | 2 |
4 files changed, 4 insertions, 4 deletions
@@ -66,7 +66,7 @@ func printBranch(branch Branch, maxWidth int) { var s string s += numberStyle.Render(branch.Name) s += genericStyle.Render(" ") - s += titleStyle.Render(truncate.String(branch.LastCommit.MessageHeadline, uint(80-maxWidth))) + s += titleStyle.Render(truncate.StringWithTail(branch.LastCommit.MessageHeadline, uint(80-maxWidth), "…")) s += genericStyle.Render(" ") s += timeStyle.Render(ago(branch.LastCommit.CommittedAt)) s += genericStyle.Render(" ") @@ -94,7 +94,7 @@ func printCommit(commit Commit) { var s string s += numberStyle.Render(commit.ID[:7]) s += genericStyle.Render(" ") - s += titleStyle.Render(truncate.String(commit.MessageHeadline, 80-7)) + s += titleStyle.Render(truncate.StringWithTail(commit.MessageHeadline, 80-7, "…")) s += genericStyle.Render(" ") s += timeStyle.Render(ago(commit.CommittedAt)) s += genericStyle.Render(" ") @@ -105,7 +105,7 @@ func printIssue(issue Issue, maxWidth int) { var s string s += numberStyle.Render(strconv.Itoa(issue.ID)) s += genericStyle.Render(" ") - s += titleStyle.Render(truncate.String(issue.Title, uint(80-maxWidth))) + s += titleStyle.Render(truncate.StringWithTail(issue.Title, uint(80-maxWidth), "…")) s += genericStyle.Render(" ") s += timeStyle.Render(ago(issue.CreatedAt)) s += genericStyle.Render(" ") @@ -106,7 +106,7 @@ func printPullRequest(pr PullRequest, maxWidth int) { var s string s += numberStyle.Render(strconv.Itoa(pr.ID)) s += genericStyle.Render(" ") - s += titleStyle.Render(truncate.String(pr.Title, uint(80-maxWidth))) + s += titleStyle.Render(truncate.StringWithTail(pr.Title, uint(80-maxWidth), "…")) s += genericStyle.Render(" ") s += timeStyle.Render(ago(pr.CreatedAt)) s += genericStyle.Render(" ") |