mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Rename SigilStr to PaginationMarker
Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
parent
a18f77bfad
commit
3521ebf6e8
@ -151,7 +151,9 @@ func (common *Common) RightAlignFormat(width int) string {
|
|||||||
return fmt.Sprintf("%%%ds", width-borderOffset)
|
return fmt.Sprintf("%%%ds", width-borderOffset)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (common *Common) SigilStr(len, pos, width int) string {
|
// PaginationMarker generates the pagination indicators that appear in the top-right corner
|
||||||
|
// of multisource widgets
|
||||||
|
func (common *Common) PaginationMarker(len, pos, width int) string {
|
||||||
sigils := ""
|
sigils := ""
|
||||||
|
|
||||||
if len > 1 {
|
if len > 1 {
|
||||||
|
@ -144,7 +144,7 @@ func Test_RightAlignFormat(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func Test_SigilStr(t *testing.T) {
|
func Test_PaginationMarker(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
len int
|
len int
|
||||||
@ -184,7 +184,7 @@ func Test_SigilStr(t *testing.T) {
|
|||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
assert.Equal(t, tt.expected, testCfg.SigilStr(tt.len, tt.pos, tt.width))
|
assert.Equal(t, tt.expected, testCfg.PaginationMarker(tt.len, tt.pos, tt.width))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.SigilStr(len(widget.workflows), widget.Idx, width) + "\n"
|
str := widget.settings.common.PaginationMarker(len(widget.workflows), widget.Idx, width) + "\n"
|
||||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(workflow))
|
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(workflow))
|
||||||
|
|
||||||
str += widget.displayWorkflowRuns(workflow)
|
str += widget.displayWorkflowRuns(workflow)
|
||||||
|
@ -23,7 +23,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
filter := widget.currentFilter()
|
filter := widget.currentFilter()
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
|
|
||||||
str := widget.settings.common.SigilStr(len(widget.filters), widget.Idx, width) + "\n"
|
str := widget.settings.common.PaginationMarker(len(widget.filters), widget.Idx, width) + "\n"
|
||||||
str += widget.displayQueue(filter)
|
str += widget.displayQueue(filter)
|
||||||
|
|
||||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(filter))
|
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(filter))
|
||||||
|
@ -22,7 +22,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
title = fmt.Sprintf("%s- %s", widget.CommonSettings().Title, widget.title(project))
|
title = fmt.Sprintf("%s- %s", widget.CommonSettings().Title, widget.title(project))
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.SigilStr(len(widget.GerritProjects), widget.Idx, width) + "\n"
|
str := widget.settings.common.PaginationMarker(len(widget.GerritProjects), widget.Idx, width) + "\n"
|
||||||
str += fmt.Sprintf(" [%s]Stats[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf(" [%s]Stats[white]\n", widget.settings.common.Colors.Subheading)
|
||||||
str += widget.displayStats(project)
|
str += widget.displayStats(project)
|
||||||
str += "\n"
|
str += "\n"
|
||||||
|
@ -23,7 +23,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.SigilStr(len(widget.GitRepos), widget.Idx, width) + "\n"
|
str := widget.settings.common.PaginationMarker(len(widget.GitRepos), widget.Idx, width) + "\n"
|
||||||
str += fmt.Sprintf(" [%s]Branch[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf(" [%s]Branch[white]\n", widget.settings.common.Colors.Subheading)
|
||||||
str += fmt.Sprintf(" %s", repoData.Branch)
|
str += fmt.Sprintf(" %s", repoData.Branch)
|
||||||
str += "\n"
|
str += "\n"
|
||||||
|
@ -35,7 +35,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.SigilStr(len(widget.GithubRepos), widget.Idx, width)
|
str := widget.settings.common.PaginationMarker(len(widget.GithubRepos), widget.Idx, width)
|
||||||
if widget.settings.showStats {
|
if widget.settings.showStats {
|
||||||
str += fmt.Sprintf("\n [%s]Stats[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf("\n [%s]Stats[white]\n", widget.settings.common.Colors.Subheading)
|
||||||
str += widget.displayStats(repo)
|
str += widget.displayStats(repo)
|
||||||
|
@ -39,7 +39,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(project))
|
title := fmt.Sprintf("%s - %s", widget.CommonSettings().Title, widget.title(project))
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.SigilStr(len(widget.GitlabProjects), widget.Idx, width) + "\n"
|
str := widget.settings.common.PaginationMarker(len(widget.GitlabProjects), widget.Idx, width) + "\n"
|
||||||
str += fmt.Sprintf(" [%s]Stats[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf(" [%s]Stats[white]\n", widget.settings.common.Colors.Subheading)
|
||||||
str += widget.displayStats(project)
|
str += widget.displayStats(project)
|
||||||
str += "\n"
|
str += "\n"
|
||||||
|
@ -23,7 +23,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.SigilStr(len(widget.Data), widget.Idx, width) + "\n"
|
str := widget.settings.common.PaginationMarker(len(widget.Data), widget.Idx, width) + "\n"
|
||||||
str += fmt.Sprintf(" [%s]Branch:Bookmark[white]\n", widget.settings.common.Colors.Subheading)
|
str += fmt.Sprintf(" [%s]Branch:Bookmark[white]\n", widget.settings.common.Colors.Subheading)
|
||||||
str += fmt.Sprintf(" %s:%s\n", repoData.Branch, repoData.Bookmark)
|
str += fmt.Sprintf(" %s:%s\n", repoData.Branch, repoData.Bookmark)
|
||||||
str += "\n"
|
str += "\n"
|
||||||
|
@ -78,7 +78,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
text := widget.settings.common.SigilStr(len(widget.Sources), widget.Idx, width) + "\n"
|
text := widget.settings.common.PaginationMarker(len(widget.Sources), widget.Idx, width) + "\n"
|
||||||
|
|
||||||
if widget.settings.format {
|
if widget.settings.format {
|
||||||
text += widget.formattedText()
|
text += widget.formattedText()
|
||||||
|
@ -72,7 +72,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.SigilStr(len(widget.Sources), widget.Idx, width-2) + "\n"
|
str := widget.settings.common.PaginationMarker(len(widget.Sources), widget.Idx, width-2) + "\n"
|
||||||
for _, tweet := range tweets {
|
for _, tweet := range tweets {
|
||||||
str += widget.format(tweet)
|
str += widget.format(tweet)
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ func (widget *Widget) content() (string, string, bool) {
|
|||||||
} else {
|
} else {
|
||||||
title = widget.buildTitle(cityData)
|
title = widget.buildTitle(cityData)
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
content = widget.settings.common.SigilStr(len(widget.Data), widget.Idx, width) + "\n"
|
content = widget.settings.common.PaginationMarker(len(widget.Data), widget.Idx, width) + "\n"
|
||||||
content += widget.description(cityData) + "\n\n"
|
content += widget.description(cityData) + "\n\n"
|
||||||
content += widget.temperatures(cityData) + "\n"
|
content += widget.temperatures(cityData) + "\n"
|
||||||
content += widget.sunInfo(cityData)
|
content += widget.sunInfo(cityData)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user