File tree Expand file tree Collapse file tree 3 files changed +16
-15
lines changed
Expand file tree Collapse file tree 3 files changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ func issueList(cmd *cobra.Command, args []string) error {
148148 if labels != "" && table .IsTTY () {
149149 labels = fmt .Sprintf ("(%s)" , labels )
150150 }
151- table .AddField (issueNum , nil , colorFuncForState (issue .State ))
151+ table .AddField (issueNum , nil , utils . ColorFuncForState (issue .State ))
152152 table .AddField (replaceExcessiveWhitespace (issue .Title ), nil , nil )
153153 table .AddField (labels , nil , utils .Gray )
154154 table .EndRow ()
Original file line number Diff line number Diff line change @@ -232,20 +232,7 @@ func colorFuncForPR(pr api.PullRequest) func(string) string {
232232 if pr .State == "OPEN" && pr .IsDraft {
233233 return utils .Gray
234234 } else {
235- return colorFuncForState (pr .State )
236- }
237- }
238-
239- func colorFuncForState (state string ) func (string ) string {
240- switch state {
241- case "OPEN" :
242- return utils .Green
243- case "CLOSED" :
244- return utils .Red
245- case "MERGED" :
246- return utils .Magenta
247- default :
248- return nil
235+ return utils .ColorFuncForState (pr .State )
249236 }
250237}
251238
Original file line number Diff line number Diff line change @@ -57,3 +57,17 @@ func FuzzyAgo(ago time.Duration) string {
5757func Spinner () * spinner.Spinner {
5858 return spinner .New (spinner .CharSets [11 ], 400 * time .Millisecond )
5959}
60+
61+ // ColorFuncForState returns a color function for a PR/Issue state
62+ func ColorFuncForState (state string ) func (string ) string {
63+ switch state {
64+ case "OPEN" :
65+ return Green
66+ case "CLOSED" :
67+ return Red
68+ case "MERGED" :
69+ return Magenta
70+ default :
71+ return nil
72+ }
73+ }
You can’t perform that action at this time.
0 commit comments