mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Now possible to define the characters for use in paging indicators
This commit is contained in:
parent
0cdd859aa7
commit
5f7c3260c1
@ -20,7 +20,7 @@ func (widget *Widget) display() {
|
||||
title := fmt.Sprintf("[green]%s[white]\n", repoData.Repository)
|
||||
widget.View.SetTitle(fmt.Sprintf(" Git: %s ", title))
|
||||
|
||||
str := widget.tickMarks(widget.Data) + "\n"
|
||||
str := wtf.SygilStr(len(widget.Data), widget.Idx, widget.View) + "\n"
|
||||
str = str + " [red]Branch[white]\n"
|
||||
str = str + fmt.Sprintf(" %s", repoData.Branch)
|
||||
str = str + "\n"
|
||||
@ -83,16 +83,3 @@ func (widget *Widget) formatCommits(data []string) string {
|
||||
func (widget *Widget) formatCommit(line string) string {
|
||||
return fmt.Sprintf(" %s\n", strings.Replace(line, "\"", "", -1))
|
||||
}
|
||||
|
||||
func (widget *Widget) tickMarks(data []*GitRepo) 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
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package github
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
)
|
||||
@ -18,7 +17,7 @@ func (widget *Widget) display() {
|
||||
|
||||
widget.View.SetTitle(fmt.Sprintf(" Github: %s ", widget.title(repo)))
|
||||
|
||||
str := widget.tickMarks(widget.Data) + "\n"
|
||||
str := wtf.SygilStr(len(widget.Data), widget.Idx, widget.View) + "\n"
|
||||
str = str + " [red]Open Review Requests[white]\n"
|
||||
str = str + widget.prsForReview(repo, Config.UString("wtf.mods.github.username"))
|
||||
str = str + "\n"
|
||||
@ -72,19 +71,6 @@ 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)
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ func (widget *Widget) display() {
|
||||
|
||||
widget.View.SetTitle(widget.title(cityData))
|
||||
|
||||
str := widget.tickMarks(widget.Data) + "\n"
|
||||
str := wtf.SygilStr(len(widget.Data), widget.Idx, widget.View) + "\n"
|
||||
str = str + widget.description(cityData) + "\n\n"
|
||||
str = str + widget.temperatures(cityData) + "\n"
|
||||
str = str + widget.sunInfo(cityData)
|
||||
@ -67,19 +67,6 @@ func (widget *Widget) temperatures(cityData *owm.CurrentWeatherData) string {
|
||||
return str
|
||||
}
|
||||
|
||||
func (widget *Widget) tickMarks(data []*owm.CurrentWeatherData) 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(cityData *owm.CurrentWeatherData) string {
|
||||
return fmt.Sprintf(" %s %s ", widget.icon(cityData), cityData.Name)
|
||||
}
|
||||
|
14
wtf/utils.go
14
wtf/utils.go
@ -119,6 +119,20 @@ func RowColor(module string, idx int) string {
|
||||
}
|
||||
}
|
||||
|
||||
func SygilStr(len, pos int, view *tview.TextView) string {
|
||||
sygils := ""
|
||||
|
||||
if len > 0 {
|
||||
sygils = strings.Repeat(Config.UString("wtf.paging.pageSygil", "*"), pos)
|
||||
sygils = sygils + Config.UString("wtf.paging.selectedSygil", "_")
|
||||
sygils = sygils + strings.Repeat(Config.UString("wtf.paging.pageSygil", "*"), len-1-pos)
|
||||
|
||||
sygils = "[lightblue]" + fmt.Sprintf(RightAlignFormat(view), sygils) + "[white]"
|
||||
}
|
||||
|
||||
return sygils
|
||||
}
|
||||
|
||||
/* -------------------- Slice Conversion -------------------- */
|
||||
|
||||
func ToInts(slice []interface{}) []int {
|
||||
|
Loading…
x
Reference in New Issue
Block a user