mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Multi-github now with tick marks
This commit is contained in:
parent
66f11e8b8b
commit
84290ffe76
@ -2,6 +2,9 @@ package github
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
)
|
||||
|
||||
func (widget *Widget) display() {
|
||||
@ -15,7 +18,8 @@ func (widget *Widget) display() {
|
||||
|
||||
widget.View.SetTitle(fmt.Sprintf(" Github: %s ", widget.title(repo)))
|
||||
|
||||
str := " [red]Open Review Requests[white]\n"
|
||||
str := widget.tickMarks(widget.Data) + "\n"
|
||||
str = str + " [red]Open Review Requests[white]\n"
|
||||
str = str + widget.prsForReview(repo, Config.UString("wtf.mods.github.username"))
|
||||
str = str + "\n"
|
||||
str = str + " [red]Open Pull Requests[white]\n"
|
||||
@ -68,6 +72,18 @@ func (widget *Widget) prsForReview(repo *GithubRepo, username string) string {
|
||||
return str
|
||||
}
|
||||
|
||||
func (widget *Widget) tickMarks(data []*GithubRepo) string {
|
||||
str := ""
|
||||
|
||||
if len(data) > 1 {
|
||||
marks := strings.Repeat("*", len(data))
|
||||
marks = marks[:widget.Idx] + "_" + marks[widget.Idx+1:]
|
||||
|
||||
str = "[lightblue]" + fmt.Sprintf(wtf.RightAlignFormat(widget.View), marks) + "[white]"
|
||||
}
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
func (widget *Widget) title(repo *GithubRepo) string {
|
||||
return fmt.Sprintf("[green]%s - %s[white]", repo.Owner, repo.Name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user