mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
commit
0c0c6e94e0
@ -148,8 +148,8 @@ func (common *Common) SigilStr(len, pos int, width int) string {
|
|||||||
|
|
||||||
if len > 1 {
|
if len > 1 {
|
||||||
sigils = strings.Repeat(common.Sigils.Paging.Normal, pos)
|
sigils = strings.Repeat(common.Sigils.Paging.Normal, pos)
|
||||||
sigils = sigils + common.Sigils.Paging.Selected
|
sigils += common.Sigils.Paging.Selected
|
||||||
sigils = sigils + strings.Repeat(common.Sigils.Paging.Normal, len-1-pos)
|
sigils += strings.Repeat(common.Sigils.Paging.Normal, len-1-pos)
|
||||||
|
|
||||||
sigils = "[lightblue]" + fmt.Sprintf(common.RightAlignFormat(width), sigils) + "[white]"
|
sigils = "[lightblue]" + fmt.Sprintf(common.RightAlignFormat(width), sigils) + "[white]"
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ func (list *Checklist) Update(text string) {
|
|||||||
|
|
||||||
// Prev selects the previous item UP in the checklist
|
// Prev selects the previous item UP in the checklist
|
||||||
func (list *Checklist) Prev() {
|
func (list *Checklist) Prev() {
|
||||||
list.selected = list.selected - 1
|
list.selected--
|
||||||
if list.selected < 0 {
|
if list.selected < 0 {
|
||||||
list.selected = len(list.Items) - 1
|
list.selected = len(list.Items) - 1
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ func (list *Checklist) Prev() {
|
|||||||
|
|
||||||
// Next selects the next item DOWN in the checklist
|
// Next selects the next item DOWN in the checklist
|
||||||
func (list *Checklist) Next() {
|
func (list *Checklist) Next() {
|
||||||
list.selected = list.selected + 1
|
list.selected++
|
||||||
if list.selected >= len(list.Items) {
|
if list.selected >= len(list.Items) {
|
||||||
list.selected = 0
|
list.selected = 0
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ func (widget *Widget) contentFrom(items []Item) string {
|
|||||||
|
|
||||||
str := ""
|
str := ""
|
||||||
for _, item := range items {
|
for _, item := range items {
|
||||||
str = str + widget.format(item)
|
str += widget.format(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
|
@ -56,7 +56,7 @@ func (widget *Widget) contentFrom(builds []*Build) string {
|
|||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
str = str + fmt.Sprintf(
|
str += fmt.Sprintf(
|
||||||
"[%s] %s-%d (%s) [white]%s\n",
|
"[%s] %s-%d (%s) [white]%s\n",
|
||||||
buildColor(build),
|
buildColor(build),
|
||||||
build.Reponame,
|
build.Reponame,
|
||||||
|
@ -19,7 +19,7 @@ func (widget *Widget) display(clocks []Clock, dateFormat string, timeFormat stri
|
|||||||
rowColor = widget.settings.colors.rows.even
|
rowColor = widget.settings.colors.rows.even
|
||||||
}
|
}
|
||||||
|
|
||||||
str = str + fmt.Sprintf(
|
str += fmt.Sprintf(
|
||||||
" [%s]%-12s %-10s %7s[white]\n",
|
" [%s]%-12s %-10s %7s[white]\n",
|
||||||
rowColor,
|
rowColor,
|
||||||
clock.Label,
|
clock.Label,
|
||||||
|
@ -60,7 +60,7 @@ func (widget *Widget) contentFrom(positions *AllPositionsResponse) string {
|
|||||||
totalFiat += positions.PositionList[i].HoldingValueFiat
|
totalFiat += positions.PositionList[i].HoldingValueFiat
|
||||||
|
|
||||||
if widget.settings.displayHoldings {
|
if widget.settings.displayHoldings {
|
||||||
res = res + fmt.Sprintf(
|
res += fmt.Sprintf(
|
||||||
"[%s]%-6s - %5.2f ([%s]%.3fk [%s]%.2f%s)\n",
|
"[%s]%-6s - %5.2f ([%s]%.3fk [%s]%.2f%s)\n",
|
||||||
widget.settings.colors.name,
|
widget.settings.colors.name,
|
||||||
positions.PositionList[i].Coin,
|
positions.PositionList[i].Coin,
|
||||||
@ -72,7 +72,7 @@ func (widget *Widget) contentFrom(positions *AllPositionsResponse) string {
|
|||||||
"%",
|
"%",
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
res = res + fmt.Sprintf(
|
res += fmt.Sprintf(
|
||||||
"[%s]%-6s - %5.2f ([%s]%.2f%s)\n",
|
"[%s]%-6s - %5.2f ([%s]%.2f%s)\n",
|
||||||
widget.settings.colors.name,
|
widget.settings.colors.name,
|
||||||
positions.PositionList[i].Coin,
|
positions.PositionList[i].Coin,
|
||||||
@ -85,7 +85,7 @@ func (widget *Widget) contentFrom(positions *AllPositionsResponse) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if widget.settings.displayHoldings {
|
if widget.settings.displayHoldings {
|
||||||
res = res + fmt.Sprintf("\n[%s]Total value: $%.3fk", "green", totalFiat/1000)
|
res += fmt.Sprintf("\n[%s]Total value: $%.3fk", "green", totalFiat/1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
@ -48,8 +48,7 @@ func (widget *Widget) Refresh() {
|
|||||||
|
|
||||||
for _, monitor := range monitors {
|
for _, monitor := range monitors {
|
||||||
state := *monitor.OverallState
|
state := *monitor.OverallState
|
||||||
switch state {
|
if state == "Alert" {
|
||||||
case "Alert":
|
|
||||||
triggeredMonitors = append(triggeredMonitors, monitor)
|
triggeredMonitors = append(triggeredMonitors, monitor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,7 +73,7 @@ func (widget *Widget) contentFrom(triggeredMonitors []datadog.Monitor) string {
|
|||||||
var str string
|
var str string
|
||||||
|
|
||||||
if len(triggeredMonitors) > 0 {
|
if len(triggeredMonitors) > 0 {
|
||||||
str = str + fmt.Sprintf(
|
str += fmt.Sprintf(
|
||||||
" %s\n",
|
" %s\n",
|
||||||
"[red]Triggered Monitors[white]",
|
"[red]Triggered Monitors[white]",
|
||||||
)
|
)
|
||||||
@ -87,7 +86,7 @@ func (widget *Widget) contentFrom(triggeredMonitors []datadog.Monitor) string {
|
|||||||
) + "\n"
|
) + "\n"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
str = str + fmt.Sprintf(
|
str += fmt.Sprintf(
|
||||||
" %s\n",
|
" %s\n",
|
||||||
"[green]No Triggered Monitors[white]",
|
"[green]No Triggered Monitors[white]",
|
||||||
)
|
)
|
||||||
|
@ -63,14 +63,14 @@ func (widget *Widget) contentFrom(calEvents []*CalEvent) string {
|
|||||||
title,
|
title,
|
||||||
)
|
)
|
||||||
|
|
||||||
str = str + fmt.Sprintf("%s %s%s\n",
|
str += fmt.Sprintf("%s %s%s\n",
|
||||||
lineOne,
|
lineOne,
|
||||||
widget.location(calEvent),
|
widget.location(calEvent),
|
||||||
widget.timeUntil(calEvent),
|
widget.timeUntil(calEvent),
|
||||||
)
|
)
|
||||||
|
|
||||||
if (widget.location(calEvent) != "") || (widget.timeUntil(calEvent) != "") {
|
if (widget.location(calEvent) != "") || (widget.timeUntil(calEvent) != "") {
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
prevEvent = calEvent
|
prevEvent = calEvent
|
||||||
|
@ -16,14 +16,14 @@ func (widget *Widget) display() {
|
|||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.SigilStr(len(widget.GerritProjects), widget.Idx, width) + "\n"
|
str := widget.settings.common.SigilStr(len(widget.GerritProjects), widget.Idx, width) + "\n"
|
||||||
str = str + " [red]Stats[white]\n"
|
str += " [red]Stats[white]\n"
|
||||||
str = str + widget.displayStats(project)
|
str += widget.displayStats(project)
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
str = str + " [red]Open Incoming Reviews[white]\n"
|
str += " [red]Open Incoming Reviews[white]\n"
|
||||||
str = str + widget.displayMyIncomingReviews(project, widget.settings.username)
|
str += widget.displayMyIncomingReviews(project, widget.settings.username)
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
str = str + " [red]My Outgoing Reviews[white]\n"
|
str += " [red]My Outgoing Reviews[white]\n"
|
||||||
str = str + widget.displayMyOutgoingReviews(project, widget.settings.username)
|
str += widget.displayMyOutgoingReviews(project, widget.settings.username)
|
||||||
|
|
||||||
widget.Redraw(title, str, false)
|
widget.Redraw(title, str, false)
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ func (widget *Widget) displayMyIncomingReviews(project *GerritProject, username
|
|||||||
|
|
||||||
str := ""
|
str := ""
|
||||||
for idx, r := range project.IncomingReviews {
|
for idx, r := range project.IncomingReviews {
|
||||||
str = str + fmt.Sprintf(" [%s] [green]%d[white] [%s] %s\n", widget.rowColor(idx), r.Number, widget.rowColor(idx), r.Subject)
|
str += fmt.Sprintf(" [%s] [green]%d[white] [%s] %s\n", widget.rowColor(idx), r.Number, widget.rowColor(idx), r.Subject)
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
@ -48,7 +48,7 @@ func (widget *Widget) displayMyOutgoingReviews(project *GerritProject, username
|
|||||||
|
|
||||||
str := ""
|
str := ""
|
||||||
for idx, r := range project.OutgoingReviews {
|
for idx, r := range project.OutgoingReviews {
|
||||||
str = str + fmt.Sprintf(" [%s] [green]%d[white] [%s] %s\n", widget.rowColor(idx+len(project.IncomingReviews)), r.Number, widget.rowColor(idx+len(project.IncomingReviews)), r.Subject)
|
str += fmt.Sprintf(" [%s] [green]%d[white] [%s] %s\n", widget.rowColor(idx+len(project.IncomingReviews)), r.Number, widget.rowColor(idx+len(project.IncomingReviews)), r.Subject)
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
|
@ -97,7 +97,7 @@ func (widget *Widget) HelpText() string {
|
|||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) nextProject() {
|
func (widget *Widget) nextProject() {
|
||||||
widget.Idx = widget.Idx + 1
|
widget.Idx++
|
||||||
widget.unselect()
|
widget.unselect()
|
||||||
if widget.Idx == len(widget.GerritProjects) {
|
if widget.Idx == len(widget.GerritProjects) {
|
||||||
widget.Idx = 0
|
widget.Idx = 0
|
||||||
@ -107,7 +107,7 @@ func (widget *Widget) nextProject() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) prevProject() {
|
func (widget *Widget) prevProject() {
|
||||||
widget.Idx = widget.Idx - 1
|
widget.Idx--
|
||||||
if widget.Idx < 0 {
|
if widget.Idx < 0 {
|
||||||
widget.Idx = len(widget.GerritProjects) - 1
|
widget.Idx = len(widget.GerritProjects) - 1
|
||||||
}
|
}
|
||||||
|
@ -17,25 +17,24 @@ func (widget *Widget) display() {
|
|||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.SigilStr(len(widget.GitRepos), widget.Idx, width) + "\n"
|
str := widget.settings.common.SigilStr(len(widget.GitRepos), widget.Idx, width) + "\n"
|
||||||
str = str + " [red]Branch[white]\n"
|
str += " [red]Branch[white]\n"
|
||||||
str = str + fmt.Sprintf(" %s", repoData.Branch)
|
str += fmt.Sprintf(" %s", repoData.Branch)
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
str = str + widget.formatChanges(repoData.ChangedFiles)
|
str += widget.formatChanges(repoData.ChangedFiles)
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
str = str + widget.formatCommits(repoData.Commits)
|
str += widget.formatCommits(repoData.Commits)
|
||||||
|
|
||||||
widget.Redraw(title, str, false)
|
widget.Redraw(title, str, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) formatChanges(data []string) string {
|
func (widget *Widget) formatChanges(data []string) string {
|
||||||
str := ""
|
str := " [red]Changed Files[white]\n"
|
||||||
str = str + " [red]Changed Files[white]\n"
|
|
||||||
|
|
||||||
if len(data) == 1 {
|
if len(data) == 1 {
|
||||||
str = str + " [grey]none[white]\n"
|
str += " [grey]none[white]\n"
|
||||||
} else {
|
} else {
|
||||||
for _, line := range data {
|
for _, line := range data {
|
||||||
str = str + widget.formatChange(line)
|
str += widget.formatChange(line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,11 +65,10 @@ func (widget *Widget) formatChange(line string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) formatCommits(data []string) string {
|
func (widget *Widget) formatCommits(data []string) string {
|
||||||
str := ""
|
str := " [red]Recent Commits[white]\n"
|
||||||
str = str + " [red]Recent Commits[white]\n"
|
|
||||||
|
|
||||||
for _, line := range data {
|
for _, line := range data {
|
||||||
str = str + widget.formatCommit(line)
|
str += widget.formatCommit(line)
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
|
@ -16,14 +16,14 @@ func (widget *Widget) display() {
|
|||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.SigilStr(len(widget.GithubRepos), widget.Idx, width) + "\n"
|
str := widget.settings.common.SigilStr(len(widget.GithubRepos), widget.Idx, width) + "\n"
|
||||||
str = str + " [red]Stats[white]\n"
|
str += " [red]Stats[white]\n"
|
||||||
str = str + widget.displayStats(repo)
|
str += widget.displayStats(repo)
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
str = str + " [red]Open Review Requests[white]\n"
|
str += " [red]Open Review Requests[white]\n"
|
||||||
str = str + widget.displayMyReviewRequests(repo, widget.settings.username)
|
str += widget.displayMyReviewRequests(repo, widget.settings.username)
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
str = str + " [red]My Pull Requests[white]\n"
|
str += " [red]My Pull Requests[white]\n"
|
||||||
str = str + widget.displayMyPullRequests(repo, widget.settings.username)
|
str += widget.displayMyPullRequests(repo, widget.settings.username)
|
||||||
|
|
||||||
widget.TextWidget.Redraw(title, str, false)
|
widget.TextWidget.Redraw(title, str, false)
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ func (widget *Widget) displayMyPullRequests(repo *GithubRepo, username string) s
|
|||||||
|
|
||||||
str := ""
|
str := ""
|
||||||
for _, pr := range prs {
|
for _, pr := range prs {
|
||||||
str = str + fmt.Sprintf(" %s[green]%4d[white] %s\n", widget.mergeString(pr), *pr.Number, *pr.Title)
|
str += fmt.Sprintf(" %s[green]%4d[white] %s\n", widget.mergeString(pr), *pr.Number, *pr.Title)
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
@ -52,7 +52,7 @@ func (widget *Widget) displayMyReviewRequests(repo *GithubRepo, username string)
|
|||||||
|
|
||||||
str := ""
|
str := ""
|
||||||
for _, pr := range prs {
|
for _, pr := range prs {
|
||||||
str = str + fmt.Sprintf(" [green]%4d[white] %s\n", *pr.Number, *pr.Title)
|
str += fmt.Sprintf(" [green]%4d[white] %s\n", *pr.Number, *pr.Title)
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
|
@ -16,14 +16,14 @@ func (widget *Widget) display() {
|
|||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.SigilStr(len(widget.GitlabProjects), widget.Idx, width) + "\n"
|
str := widget.settings.common.SigilStr(len(widget.GitlabProjects), widget.Idx, width) + "\n"
|
||||||
str = str + " [red]Stats[white]\n"
|
str += " [red]Stats[white]\n"
|
||||||
str = str + widget.displayStats(project)
|
str += widget.displayStats(project)
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
str = str + " [red]Open Approval Requests[white]\n"
|
str += " [red]Open Approval Requests[white]\n"
|
||||||
str = str + widget.displayMyApprovalRequests(project, widget.settings.username)
|
str += widget.displayMyApprovalRequests(project, widget.settings.username)
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
str = str + " [red]My Merge Requests[white]\n"
|
str += " [red]My Merge Requests[white]\n"
|
||||||
str = str + widget.displayMyMergeRequests(project, widget.settings.username)
|
str += widget.displayMyMergeRequests(project, widget.settings.username)
|
||||||
widget.Redraw(title, str, false)
|
widget.Redraw(title, str, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ func (widget *Widget) displayMyMergeRequests(project *GitlabProject, username st
|
|||||||
|
|
||||||
str := ""
|
str := ""
|
||||||
for _, mr := range mrs {
|
for _, mr := range mrs {
|
||||||
str = str + fmt.Sprintf(" [green]%4d[white] %s\n", mr.IID, mr.Title)
|
str += fmt.Sprintf(" [green]%4d[white] %s\n", mr.IID, mr.Title)
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
@ -51,7 +51,7 @@ func (widget *Widget) displayMyApprovalRequests(project *GitlabProject, username
|
|||||||
|
|
||||||
str := ""
|
str := ""
|
||||||
for _, mr := range mrs {
|
for _, mr := range mrs {
|
||||||
str = str + fmt.Sprintf(" [green]%4d[white] %s\n", mr.IID, mr.Title)
|
str += fmt.Sprintf(" [green]%4d[white] %s\n", mr.IID, mr.Title)
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
|
@ -56,7 +56,7 @@ func (widget *Widget) Refresh() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) Next() {
|
func (widget *Widget) Next() {
|
||||||
widget.Idx = widget.Idx + 1
|
widget.Idx++
|
||||||
if widget.Idx == len(widget.GitlabProjects) {
|
if widget.Idx == len(widget.GitlabProjects) {
|
||||||
widget.Idx = 0
|
widget.Idx = 0
|
||||||
}
|
}
|
||||||
@ -65,7 +65,7 @@ func (widget *Widget) Next() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) Prev() {
|
func (widget *Widget) Prev() {
|
||||||
widget.Idx = widget.Idx - 1
|
widget.Idx--
|
||||||
if widget.Idx < 0 {
|
if widget.Idx < 0 {
|
||||||
widget.Idx = len(widget.GitlabProjects) - 1
|
widget.Idx = len(widget.GitlabProjects) - 1
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ func (widget *Widget) display() {
|
|||||||
func (widget *Widget) contentFrom(messages []Message) string {
|
func (widget *Widget) contentFrom(messages []Message) string {
|
||||||
var str string
|
var str string
|
||||||
for idx, message := range messages {
|
for idx, message := range messages {
|
||||||
str = str + fmt.Sprintf(
|
str += fmt.Sprintf(
|
||||||
`["%d"][%s] [blue]%s [lightslategray]%s: [%s]%s [aqua]%s[""]`,
|
`["%d"][%s] [blue]%s [lightslategray]%s: [%s]%s [aqua]%s[""]`,
|
||||||
idx,
|
idx,
|
||||||
widget.RowColor(idx),
|
widget.RowColor(idx),
|
||||||
@ -94,7 +94,7 @@ func (widget *Widget) contentFrom(messages []Message) string {
|
|||||||
message.Sent.Format("Jan 02, 15:04 MST"),
|
message.Sent.Format("Jan 02, 15:04 MST"),
|
||||||
)
|
)
|
||||||
|
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
|
@ -43,7 +43,7 @@ func (widget *Widget) contentFrom(valueRanges []*sheets.ValueRange) string {
|
|||||||
|
|
||||||
cells := wtf.ToStrs(widget.settings.cellNames)
|
cells := wtf.ToStrs(widget.settings.cellNames)
|
||||||
for i := 0; i < len(valueRanges); i++ {
|
for i := 0; i < len(valueRanges); i++ {
|
||||||
res = res + fmt.Sprintf("%s\t[%s]%s\n", cells[i], widget.settings.colors.values, valueRanges[i].Values[0][0])
|
res += fmt.Sprintf("%s\t[%s]%s\n", cells[i], widget.settings.colors.values, valueRanges[i].Values[0][0])
|
||||||
}
|
}
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
@ -83,7 +83,7 @@ func (widget *Widget) contentFrom(stories []Story) string {
|
|||||||
|
|
||||||
u, _ := url.Parse(story.URL)
|
u, _ := url.Parse(story.URL)
|
||||||
|
|
||||||
str = str + fmt.Sprintf(
|
str += fmt.Sprintf(
|
||||||
`["%d"][""][%s]%2d. %s [lightblue](%s)[white][""]`,
|
`["%d"][""][%s]%2d. %s [lightblue](%s)[white][""]`,
|
||||||
idx,
|
idx,
|
||||||
widget.RowColor(idx),
|
widget.RowColor(idx),
|
||||||
@ -92,7 +92,7 @@ func (widget *Widget) contentFrom(stories []Story) string {
|
|||||||
strings.TrimPrefix(u.Host, "www."),
|
strings.TrimPrefix(u.Host, "www."),
|
||||||
)
|
)
|
||||||
|
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
|
@ -46,8 +46,8 @@ func (widget *Widget) Create(jenkinsURL string, username string, apiKey string)
|
|||||||
return view, nil
|
return view, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ensureLastSlash(URL string) string {
|
func ensureLastSlash(url string) string {
|
||||||
return strings.TrimRight(URL, "/") + "/"
|
return strings.TrimRight(url, "/") + "/"
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
@ -75,7 +75,7 @@ func (widget *Widget) contentFrom(view *View) string {
|
|||||||
var validID = regexp.MustCompile(widget.settings.jobNameRegex)
|
var validID = regexp.MustCompile(widget.settings.jobNameRegex)
|
||||||
|
|
||||||
if validID.MatchString(job.Name) {
|
if validID.MatchString(job.Name) {
|
||||||
str = str + fmt.Sprintf(
|
str += fmt.Sprintf(
|
||||||
`["%d"][%s] [%s]%-6s[white][""]`,
|
`["%d"][%s] [%s]%-6s[white][""]`,
|
||||||
idx,
|
idx,
|
||||||
widget.RowColor(idx),
|
widget.RowColor(idx),
|
||||||
@ -83,7 +83,7 @@ func (widget *Widget) contentFrom(view *View) string {
|
|||||||
job.Name,
|
job.Name,
|
||||||
)
|
)
|
||||||
|
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ func (widget *Widget) contentFrom(searchResult *SearchResult) string {
|
|||||||
)
|
)
|
||||||
|
|
||||||
_, _, w, _ := widget.View.GetInnerRect()
|
_, _, w, _ := widget.View.GetInnerRect()
|
||||||
fmtStr = fmtStr + wtf.PadRow(len(issue.IssueFields.Summary), w+1)
|
fmtStr += wtf.PadRow(len(issue.IssueFields.Summary), w+1)
|
||||||
|
|
||||||
str = str + fmtStr + "\n"
|
str = str + fmtStr + "\n"
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ func (widget *Widget) contentFrom(logLines []string) string {
|
|||||||
chunks := strings.Split(line, " ")
|
chunks := strings.Split(line, " ")
|
||||||
|
|
||||||
if len(chunks) >= 4 {
|
if len(chunks) >= 4 {
|
||||||
str = str + fmt.Sprintf(
|
str += fmt.Sprintf(
|
||||||
"[green]%s[white] [yellow]%s[white] %s\n",
|
"[green]%s[white] [yellow]%s[white] %s\n",
|
||||||
chunks[0],
|
chunks[0],
|
||||||
chunks[1],
|
chunks[1],
|
||||||
|
@ -17,25 +17,24 @@ func (widget *Widget) display() {
|
|||||||
|
|
||||||
_, _, width, _ := widget.View.GetRect()
|
_, _, width, _ := widget.View.GetRect()
|
||||||
str := widget.settings.common.SigilStr(len(widget.Data), widget.Idx, width) + "\n"
|
str := widget.settings.common.SigilStr(len(widget.Data), widget.Idx, width) + "\n"
|
||||||
str = str + " [red]Branch:Bookmark[white]\n"
|
str += " [red]Branch:Bookmark[white]\n"
|
||||||
str = str + fmt.Sprintf(" %s:%s\n", repoData.Branch, repoData.Bookmark)
|
str += fmt.Sprintf(" %s:%s\n", repoData.Branch, repoData.Bookmark)
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
str = str + widget.formatChanges(repoData.ChangedFiles)
|
str += widget.formatChanges(repoData.ChangedFiles)
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
str = str + widget.formatCommits(repoData.Commits)
|
str += widget.formatCommits(repoData.Commits)
|
||||||
|
|
||||||
widget.Redraw(title, str, false)
|
widget.Redraw(title, str, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) formatChanges(data []string) string {
|
func (widget *Widget) formatChanges(data []string) string {
|
||||||
str := ""
|
str := " [red]Changed Files[white]\n"
|
||||||
str = str + " [red]Changed Files[white]\n"
|
|
||||||
|
|
||||||
if len(data) == 1 {
|
if len(data) == 1 {
|
||||||
str = str + " [grey]none[white]\n"
|
str += " [grey]none[white]\n"
|
||||||
} else {
|
} else {
|
||||||
for _, line := range data {
|
for _, line := range data {
|
||||||
str = str + widget.formatChange(line)
|
str += widget.formatChange(line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,11 +65,10 @@ func (widget *Widget) formatChange(line string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (widget *Widget) formatCommits(data []string) string {
|
func (widget *Widget) formatCommits(data []string) string {
|
||||||
str := ""
|
str := " [red]Recent Commits[white]\n"
|
||||||
str = str + " [red]Recent Commits[white]\n"
|
|
||||||
|
|
||||||
for _, line := range data {
|
for _, line := range data {
|
||||||
str = str + widget.formatCommit(line)
|
str += widget.formatCommit(line)
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
|
@ -84,7 +84,8 @@ func (widget *Widget) nbascore() string {
|
|||||||
quarter := 0.
|
quarter := 0.
|
||||||
activate := false
|
activate := false
|
||||||
for keyGame, team := range game.(map[string]interface{}) { // assertion
|
for keyGame, team := range game.(map[string]interface{}) { // assertion
|
||||||
if keyGame == "vTeam" || keyGame == "hTeam" {
|
switch keyGame {
|
||||||
|
case "vTeam", "hTeam":
|
||||||
for keyTeam, stat := range team.(map[string]interface{}) {
|
for keyTeam, stat := range team.(map[string]interface{}) {
|
||||||
if keyTeam == "triCode" {
|
if keyTeam == "triCode" {
|
||||||
if keyGame == "vTeam" {
|
if keyGame == "vTeam" {
|
||||||
@ -100,13 +101,13 @@ func (widget *Widget) nbascore() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if keyGame == "period" {
|
case "period":
|
||||||
for keyTeam, stat := range team.(map[string]interface{}) {
|
for keyTeam, stat := range team.(map[string]interface{}) {
|
||||||
if keyTeam == "current" {
|
if keyTeam == "current" {
|
||||||
quarter = stat.(float64)
|
quarter = stat.(float64)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if keyGame == "isGameActivated" {
|
case "isGameActivated":
|
||||||
activate = team.(bool)
|
activate = team.(bool)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,16 +115,17 @@ func (widget *Widget) nbascore() string {
|
|||||||
hNum, _ := strconv.Atoi(hScore)
|
hNum, _ := strconv.Atoi(hScore)
|
||||||
hColor := ""
|
hColor := ""
|
||||||
if quarter != 0 { // Compare the score
|
if quarter != 0 { // Compare the score
|
||||||
if vNum > hNum {
|
switch {
|
||||||
|
case vNum > hNum:
|
||||||
vTeam = "[orange]" + vTeam
|
vTeam = "[orange]" + vTeam
|
||||||
} else if hNum > vNum {
|
case hNum > vNum:
|
||||||
// hScore = "[orange]" + hScore
|
// hScore = "[orange]" + hScore
|
||||||
hColor = "[orange]" // For correct padding
|
hColor = "[orange]" // For correct padding
|
||||||
hTeam = hTeam + "[white]"
|
hTeam += "[white]"
|
||||||
} else {
|
default:
|
||||||
vTeam = "[orange]" + vTeam
|
vTeam = "[orange]" + vTeam
|
||||||
hColor = "[orange]"
|
hColor = "[orange]"
|
||||||
hTeam = hTeam + "[white]"
|
hTeam += "[white]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qColor := "[white]"
|
qColor := "[white]"
|
||||||
|
@ -73,7 +73,7 @@ func (widget *Widget) contentFrom(deploys []nr.ApplicationDeployment) string {
|
|||||||
revLen = len(deploy.Revision)
|
revLen = len(deploy.Revision)
|
||||||
}
|
}
|
||||||
|
|
||||||
str = str + fmt.Sprintf(
|
str += fmt.Sprintf(
|
||||||
" [green]%s[%s] %s %-.16s[white]\n",
|
" [green]%s[%s] %s %-.16s[white]\n",
|
||||||
deploy.Revision[0:revLen],
|
deploy.Revision[0:revLen],
|
||||||
lineColor,
|
lineColor,
|
||||||
|
@ -61,8 +61,8 @@ func (widget *Widget) contentFrom(onCallResponses []*OnCallResponse) string {
|
|||||||
msg = fmt.Sprintf(" %s\n\n", strings.Join(wtf.NamesFromEmails(data.OnCallData.Recipients), ", "))
|
msg = fmt.Sprintf(" %s\n\n", strings.Join(wtf.NamesFromEmails(data.OnCallData.Recipients), ", "))
|
||||||
}
|
}
|
||||||
|
|
||||||
str = str + widget.cleanScheduleName(data.OnCallData.Parent.Name)
|
str += widget.cleanScheduleName(data.OnCallData.Parent.Name)
|
||||||
str = str + msg
|
str += msg
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
|
@ -48,10 +48,10 @@ func (widget *Widget) Refresh() {
|
|||||||
if err1 != nil || err2 != nil {
|
if err1 != nil || err2 != nil {
|
||||||
wrap = true
|
wrap = true
|
||||||
if err1 != nil {
|
if err1 != nil {
|
||||||
content = content + err1.Error()
|
content += err1.Error()
|
||||||
}
|
}
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
content = content + err2.Error()
|
content += err2.Error()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
widget.View.SetWrap(false)
|
widget.View.SetWrap(false)
|
||||||
@ -67,12 +67,12 @@ func (widget *Widget) contentFrom(onCalls []pagerduty.OnCall, incidents []pagerd
|
|||||||
var str string
|
var str string
|
||||||
|
|
||||||
if len(incidents) > 0 {
|
if len(incidents) > 0 {
|
||||||
str = str + "[yellow]Incidents[white]\n"
|
str += "[yellow]Incidents[white]\n"
|
||||||
for _, incident := range incidents {
|
for _, incident := range incidents {
|
||||||
str = str + fmt.Sprintf("[red]%s[white]\n", incident.Summary)
|
str += fmt.Sprintf("[red]%s[white]\n", incident.Summary)
|
||||||
str = str + fmt.Sprintf("Status: %s\n", incident.Status)
|
str += fmt.Sprintf("Status: %s\n", incident.Status)
|
||||||
str = str + fmt.Sprintf("Service: %s\n", incident.Service.Summary)
|
str += fmt.Sprintf("Service: %s\n", incident.Service.Summary)
|
||||||
str = str + fmt.Sprintf("Escalation: %s\n", incident.EscalationPolicy.Summary)
|
str += fmt.Sprintf("Escalation: %s\n", incident.EscalationPolicy.Summary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,14 +99,14 @@ func (widget *Widget) contentFrom(onCalls []pagerduty.OnCall, incidents []pagerd
|
|||||||
sort.Strings(keys)
|
sort.Strings(keys)
|
||||||
|
|
||||||
if len(keys) > 0 {
|
if len(keys) > 0 {
|
||||||
str = str + "\n[red] Schedules[white]\n"
|
str += "\n[red] Schedules[white]\n"
|
||||||
// Print out policies, and escalation order of users
|
// Print out policies, and escalation order of users
|
||||||
for _, key := range keys {
|
for _, key := range keys {
|
||||||
str = str + fmt.Sprintf("\n [green::b]%s\n", key)
|
str += fmt.Sprintf("\n [green::b]%s\n", key)
|
||||||
values := tree[key]
|
values := tree[key]
|
||||||
sort.Sort(ByEscalationLevel(values))
|
sort.Sort(ByEscalationLevel(values))
|
||||||
for _, item := range values {
|
for _, item := range values {
|
||||||
str = str + fmt.Sprintf(" [white]%d - %s\n", item.EscalationLevel, item.User.Summary)
|
str += fmt.Sprintf(" [white]%d - %s\n", item.EscalationLevel, item.User.Summary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,12 +69,11 @@ func (battery *Battery) parse(data string) string {
|
|||||||
if s := table["time to empty"]; s == "" {
|
if s := table["time to empty"]; s == "" {
|
||||||
table["time to empty"] = "∞"
|
table["time to empty"] = "∞"
|
||||||
}
|
}
|
||||||
str := ""
|
str := fmt.Sprintf(" %10s: %s\n", "Charge", battery.formatCharge(table["percentage"]))
|
||||||
str = str + fmt.Sprintf(" %10s: %s\n", "Charge", battery.formatCharge(table["percentage"]))
|
str += fmt.Sprintf(" %10s: %s\n", "Remaining", table["time to empty"])
|
||||||
str = str + fmt.Sprintf(" %10s: %s\n", "Remaining", table["time to empty"])
|
str += fmt.Sprintf(" %10s: %s\n", "State", battery.formatState(table["state"]))
|
||||||
str = str + fmt.Sprintf(" %10s: %s\n", "State", battery.formatState(table["state"]))
|
|
||||||
if s := table["time to full"]; s != "" {
|
if s := table["time to full"]; s != "" {
|
||||||
str = str + fmt.Sprintf(" %10s: %s\n", "TimeToFull", table["time to full"])
|
str += fmt.Sprintf(" %10s: %s\n", "TimeToFull", table["time to full"])
|
||||||
}
|
}
|
||||||
batteryState = table["state"]
|
batteryState = table["state"]
|
||||||
return str
|
return str
|
||||||
|
@ -32,10 +32,9 @@ func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
|||||||
func (widget *Widget) Refresh() {
|
func (widget *Widget) Refresh() {
|
||||||
widget.Battery.Refresh()
|
widget.Battery.Refresh()
|
||||||
|
|
||||||
content := ""
|
content := fmt.Sprintf(" %10s: %s\n", "Source", powerSource())
|
||||||
content = content + fmt.Sprintf(" %10s: %s\n", "Source", powerSource())
|
content += "\n"
|
||||||
content = content + "\n"
|
content += widget.Battery.String()
|
||||||
content = content + widget.Battery.String()
|
|
||||||
|
|
||||||
widget.Redraw(widget.CommonSettings.Title, content, true)
|
widget.Redraw(widget.CommonSettings.Title, content, true)
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ func (widget *Widget) contentFrom(result *Result) string {
|
|||||||
}
|
}
|
||||||
for idx, item := range result.Items {
|
for idx, item := range result.Items {
|
||||||
|
|
||||||
str = str + fmt.Sprintf(
|
str += fmt.Sprintf(
|
||||||
"[%s] [%s] %s [%s] %s [%s]count: %d [%s]%s\n",
|
"[%s] [%s] %s [%s] %s [%s]count: %d [%s]%s\n",
|
||||||
widget.RowColor(idx),
|
widget.RowColor(idx),
|
||||||
levelColor(&item),
|
levelColor(&item),
|
||||||
|
@ -42,23 +42,23 @@ func (widget *Widget) Refresh() {
|
|||||||
|
|
||||||
func (widget *Widget) contentFrom(data *SecurityData) string {
|
func (widget *Widget) contentFrom(data *SecurityData) string {
|
||||||
str := " [red]WiFi[white]\n"
|
str := " [red]WiFi[white]\n"
|
||||||
str = str + fmt.Sprintf(" %8s: %s\n", "Network", data.WifiName)
|
str += fmt.Sprintf(" %8s: %s\n", "Network", data.WifiName)
|
||||||
str = str + fmt.Sprintf(" %8s: %s\n", "Crypto", data.WifiEncryption)
|
str += fmt.Sprintf(" %8s: %s\n", "Crypto", data.WifiEncryption)
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
|
|
||||||
str = str + " [red]Firewall[white]\n"
|
str += " [red]Firewall[white]\n"
|
||||||
str = str + fmt.Sprintf(" %8s: %4s\n", "Status", data.FirewallEnabled)
|
str += fmt.Sprintf(" %8s: %4s\n", "Status", data.FirewallEnabled)
|
||||||
str = str + fmt.Sprintf(" %8s: %4s\n", "Stealth", data.FirewallStealth)
|
str += fmt.Sprintf(" %8s: %4s\n", "Stealth", data.FirewallStealth)
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
|
|
||||||
str = str + " [red]Users[white]\n"
|
str += " [red]Users[white]\n"
|
||||||
str = str + fmt.Sprintf(" %s", strings.Join(data.LoggedInUsers, "\n "))
|
str += fmt.Sprintf(" %s", strings.Join(data.LoggedInUsers, "\n "))
|
||||||
str = str + "\n\n"
|
str += "\n\n"
|
||||||
|
|
||||||
str = str + " [red]DNS[white]\n"
|
str += " [red]DNS[white]\n"
|
||||||
str = str + fmt.Sprintf(" %12s\n", data.DnsAt(0))
|
str += fmt.Sprintf(" %12s\n", data.DnsAt(0))
|
||||||
str = str + fmt.Sprintf(" %12s\n", data.DnsAt(1))
|
str += fmt.Sprintf(" %12s\n", data.DnsAt(1))
|
||||||
str = str + "\n"
|
str += "\n"
|
||||||
|
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
@ -112,8 +112,7 @@ func parseWlanNetsh(target string) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for i, token := range words {
|
for i, token := range words {
|
||||||
switch token {
|
if token == target {
|
||||||
case target:
|
|
||||||
return words[i+1]
|
return words[i+1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ func (widget *Widget) animation() string {
|
|||||||
icons := []string{"|", "/", "-", "\\", "|"}
|
icons := []string{"|", "/", "-", "\\", "|"}
|
||||||
next := icons[widget.CurrentIcon]
|
next := icons[widget.CurrentIcon]
|
||||||
|
|
||||||
widget.CurrentIcon = widget.CurrentIcon + 1
|
widget.CurrentIcon++
|
||||||
if widget.CurrentIcon == len(icons) {
|
if widget.CurrentIcon == len(icons) {
|
||||||
widget.CurrentIcon = 0
|
widget.CurrentIcon = 0
|
||||||
}
|
}
|
||||||
|
@ -76,9 +76,9 @@ func (widget *Widget) display() {
|
|||||||
text := widget.settings.common.SigilStr(len(widget.Sources), widget.Idx, width) + "\n"
|
text := widget.settings.common.SigilStr(len(widget.Sources), widget.Idx, width) + "\n"
|
||||||
|
|
||||||
if widget.settings.format {
|
if widget.settings.format {
|
||||||
text = text + widget.formattedText()
|
text += widget.formattedText()
|
||||||
} else {
|
} else {
|
||||||
text = text + widget.plainText()
|
text += widget.plainText()
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.Redraw(title, text, true)
|
widget.Redraw(title, text, true)
|
||||||
|
@ -20,13 +20,13 @@ func (widget *Widget) display() {
|
|||||||
offset := 0
|
offset := 0
|
||||||
|
|
||||||
for idx, item := range widget.list.UncheckedItems() {
|
for idx, item := range widget.list.UncheckedItems() {
|
||||||
str = str + widget.formattedItemLine(idx, item, widget.list.SelectedItem(), widget.list.LongestLine())
|
str += widget.formattedItemLine(idx, item, widget.list.SelectedItem(), widget.list.LongestLine())
|
||||||
newList.Items = append(newList.Items, item)
|
newList.Items = append(newList.Items, item)
|
||||||
offset++
|
offset++
|
||||||
}
|
}
|
||||||
|
|
||||||
for idx, item := range widget.list.CheckedItems() {
|
for idx, item := range widget.list.CheckedItems() {
|
||||||
str = str + widget.formattedItemLine(idx+offset, item, widget.list.SelectedItem(), widget.list.LongestLine())
|
str += widget.formattedItemLine(idx+offset, item, widget.list.SelectedItem(), widget.list.LongestLine())
|
||||||
newList.Items = append(newList.Items, item)
|
newList.Items = append(newList.Items, item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,12 +14,12 @@ type Project struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewProject(id int) *Project {
|
func NewProject(id int) *Project {
|
||||||
// Todoist seems to experience a lot of network issues on their side
|
// Todoist seems to experience a lot of network issues on their side
|
||||||
// If we can't connect, handle it with an empty project until we can
|
// If we can't connect, handle it with an empty project until we can
|
||||||
project, err := todoist.GetProject(id)
|
project, err := todoist.GetProject(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &Project{}
|
return &Project{}
|
||||||
}
|
}
|
||||||
|
|
||||||
proj := &Project{
|
proj := &Project{
|
||||||
Project: project,
|
Project: project,
|
||||||
@ -41,7 +41,7 @@ func (proj *Project) isLast() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (proj *Project) up() {
|
func (proj *Project) up() {
|
||||||
proj.index = proj.index - 1
|
proj.index--
|
||||||
|
|
||||||
if proj.index < 0 {
|
if proj.index < 0 {
|
||||||
proj.index = len(proj.tasks) - 1
|
proj.index = len(proj.tasks) - 1
|
||||||
@ -54,7 +54,7 @@ func (proj *Project) down() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
proj.index = proj.index + 1
|
proj.index++
|
||||||
if proj.index >= len(proj.tasks) {
|
if proj.index >= len(proj.tasks) {
|
||||||
proj.index = 0
|
proj.index = 0
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ func (widget *Widget) contentFrom(builds *Builds) string {
|
|||||||
var str string
|
var str string
|
||||||
for idx, build := range builds.Builds {
|
for idx, build := range builds.Builds {
|
||||||
|
|
||||||
str = str + fmt.Sprintf(
|
str += fmt.Sprintf(
|
||||||
"[%s] [%s] %s-%s (%s) [%s]%s - [blue]%s\n",
|
"[%s] [%s] %s-%s (%s) [%s]%s - [blue]%s\n",
|
||||||
widget.RowColor(idx),
|
widget.RowColor(idx),
|
||||||
buildColor(&build),
|
buildColor(&build),
|
||||||
|
@ -26,7 +26,7 @@ func GetCards(client *trello.Client, username string, boardName string, lists ma
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
searchResult.Total = searchResult.Total + len(cards)
|
searchResult.Total += len(cards)
|
||||||
cardArray := make([]TrelloCard, 0)
|
cardArray := make([]TrelloCard, 0)
|
||||||
|
|
||||||
for _, card := range cards {
|
for _, card := range cards {
|
||||||
|
@ -67,10 +67,10 @@ func (widget *Widget) contentFrom(searchResult *SearchResult) string {
|
|||||||
str := ""
|
str := ""
|
||||||
|
|
||||||
for list, cardArray := range searchResult.TrelloCards {
|
for list, cardArray := range searchResult.TrelloCards {
|
||||||
str = str + fmt.Sprintf(" [red]%s[white]\n", list)
|
str += fmt.Sprintf(" [red]%s[white]\n", list)
|
||||||
|
|
||||||
for _, card := range cardArray {
|
for _, card := range cardArray {
|
||||||
str = str + fmt.Sprintf(" %s[white]\n", card.Name)
|
str += fmt.Sprintf(" %s[white]\n", card.Name)
|
||||||
}
|
}
|
||||||
str = fmt.Sprintf("%s\n", str)
|
str = fmt.Sprintf("%s\n", str)
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ func (widget *Widget) display() {
|
|||||||
_, _, 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.SigilStr(len(widget.Sources), widget.Idx, width-2) + "\n"
|
||||||
for _, tweet := range tweets {
|
for _, tweet := range tweets {
|
||||||
str = str + widget.format(tweet)
|
str += widget.format(tweet)
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.Redraw(title, str, true)
|
widget.Redraw(title, str, true)
|
||||||
|
@ -35,9 +35,9 @@ func (widget *Widget) display() {
|
|||||||
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.SigilStr(len(widget.Data), widget.Idx, width) + "\n"
|
||||||
content = content + widget.description(cityData) + "\n\n"
|
content += widget.description(cityData) + "\n\n"
|
||||||
content = content + widget.temperatures(cityData) + "\n"
|
content += widget.temperatures(cityData) + "\n"
|
||||||
content = content + widget.sunInfo(cityData)
|
content += widget.sunInfo(cityData)
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.Redraw(title, content, setWrap)
|
widget.Redraw(title, content, setWrap)
|
||||||
@ -63,7 +63,7 @@ func (widget *Widget) sunInfo(cityData *owm.CurrentWeatherData) string {
|
|||||||
func (widget *Widget) temperatures(cityData *owm.CurrentWeatherData) string {
|
func (widget *Widget) temperatures(cityData *owm.CurrentWeatherData) string {
|
||||||
str := fmt.Sprintf("%8s: %4.1f° %s\n", "High", cityData.Main.TempMax, widget.settings.tempUnit)
|
str := fmt.Sprintf("%8s: %4.1f° %s\n", "High", cityData.Main.TempMax, widget.settings.tempUnit)
|
||||||
|
|
||||||
str = str + fmt.Sprintf(
|
str += fmt.Sprintf(
|
||||||
"%8s: [%s]%4.1f° %s[white]\n",
|
"%8s: [%s]%4.1f° %s[white]\n",
|
||||||
"Current",
|
"Current",
|
||||||
widget.settings.colors.current,
|
widget.settings.colors.current,
|
||||||
@ -71,7 +71,7 @@ func (widget *Widget) temperatures(cityData *owm.CurrentWeatherData) string {
|
|||||||
widget.settings.tempUnit,
|
widget.settings.tempUnit,
|
||||||
)
|
)
|
||||||
|
|
||||||
str = str + fmt.Sprintf("%8s: %4.1f° %s\n", "Low", cityData.Main.TempMin, widget.settings.tempUnit)
|
str += fmt.Sprintf("%8s: %4.1f° %s\n", "Low", cityData.Main.TempMin, widget.settings.tempUnit)
|
||||||
|
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ func (widget *Widget) Refresh() {
|
|||||||
// Next displays data for the next city data in the list. If the current city is the last
|
// Next displays data for the next city data in the list. If the current city is the last
|
||||||
// city, it wraps to the first city.
|
// city, it wraps to the first city.
|
||||||
func (widget *Widget) Next() {
|
func (widget *Widget) Next() {
|
||||||
widget.Idx = widget.Idx + 1
|
widget.Idx++
|
||||||
if widget.Idx == len(widget.Data) {
|
if widget.Idx == len(widget.Data) {
|
||||||
widget.Idx = 0
|
widget.Idx = 0
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ func (widget *Widget) Next() {
|
|||||||
// Prev displays data for the previous city in the list. If the previous city is the first
|
// Prev displays data for the previous city in the list. If the previous city is the first
|
||||||
// city, it wraps to the last city.
|
// city, it wraps to the last city.
|
||||||
func (widget *Widget) Prev() {
|
func (widget *Widget) Prev() {
|
||||||
widget.Idx = widget.Idx - 1
|
widget.Idx--
|
||||||
if widget.Idx < 0 {
|
if widget.Idx < 0 {
|
||||||
widget.Idx = len(widget.Data) - 1
|
widget.Idx = len(widget.Data) - 1
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ func (widget *Widget) textContent(items []Ticket) string {
|
|||||||
|
|
||||||
str := ""
|
str := ""
|
||||||
for idx, data := range items {
|
for idx, data := range items {
|
||||||
str = str + widget.format(data, idx)
|
str += widget.format(data, idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
|
@ -11,8 +11,7 @@ const modalHeight = 22
|
|||||||
|
|
||||||
func NewBillboardModal(text string, closeFunc func()) *tview.Frame {
|
func NewBillboardModal(text string, closeFunc func()) *tview.Frame {
|
||||||
keyboardIntercept := func(event *tcell.EventKey) *tcell.EventKey {
|
keyboardIntercept := func(event *tcell.EventKey) *tcell.EventKey {
|
||||||
switch string(event.Rune()) {
|
if string(event.Rune()) == "/" {
|
||||||
case "/":
|
|
||||||
closeFunc()
|
closeFunc()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ func (tracker *FocusTracker) blur(idx int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (tracker *FocusTracker) decrement() {
|
func (tracker *FocusTracker) decrement() {
|
||||||
tracker.Idx = tracker.Idx - 1
|
tracker.Idx--
|
||||||
|
|
||||||
if tracker.Idx < 0 {
|
if tracker.Idx < 0 {
|
||||||
tracker.Idx = len(tracker.focusables()) - 1
|
tracker.Idx = len(tracker.focusables()) - 1
|
||||||
@ -216,7 +216,7 @@ func (tracker *FocusTracker) focusState() FocusState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (tracker *FocusTracker) increment() {
|
func (tracker *FocusTracker) increment() {
|
||||||
tracker.Idx = tracker.Idx + 1
|
tracker.Idx++
|
||||||
|
|
||||||
if tracker.Idx == len(tracker.focusables()) {
|
if tracker.Idx == len(tracker.focusables()) {
|
||||||
tracker.Idx = 0
|
tracker.Idx = 0
|
||||||
|
@ -89,12 +89,12 @@ func (widget *KeyboardWidget) HelpText() string {
|
|||||||
str := "Keyboard commands for " + widget.settings.Module.Type + "\n\n"
|
str := "Keyboard commands for " + widget.settings.Module.Type + "\n\n"
|
||||||
|
|
||||||
for _, item := range widget.charHelp {
|
for _, item := range widget.charHelp {
|
||||||
str = str + fmt.Sprintf(" [%s]: %s\n", item.Key, item.Text)
|
str += fmt.Sprintf(" [%s]: %s\n", item.Key, item.Text)
|
||||||
}
|
}
|
||||||
str = str + "\n\n"
|
str += "\n\n"
|
||||||
|
|
||||||
for _, item := range widget.keyHelp {
|
for _, item := range widget.keyHelp {
|
||||||
str = str + fmt.Sprintf(" [%-*s]: %s\n", widget.maxKey, item.Key, item.Text)
|
str += fmt.Sprintf(" [%-*s]: %s\n", widget.maxKey, item.Key, item.Text)
|
||||||
}
|
}
|
||||||
|
|
||||||
return str
|
return str
|
||||||
|
@ -45,7 +45,7 @@ func (widget *MultiSourceWidget) CurrentSource() string {
|
|||||||
// Next displays the next source in the source list. If the current source is the last
|
// Next displays the next source in the source list. If the current source is the last
|
||||||
// source it wraps around to the first source
|
// source it wraps around to the first source
|
||||||
func (widget *MultiSourceWidget) NextSource() {
|
func (widget *MultiSourceWidget) NextSource() {
|
||||||
widget.Idx = widget.Idx + 1
|
widget.Idx++
|
||||||
if widget.Idx == len(widget.Sources) {
|
if widget.Idx == len(widget.Sources) {
|
||||||
widget.Idx = 0
|
widget.Idx = 0
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ func (widget *MultiSourceWidget) NextSource() {
|
|||||||
// Prev displays the previous source in the source list. If the current source is the first
|
// Prev displays the previous source in the source list. If the current source is the first
|
||||||
// source, it wraps around to the last source
|
// source, it wraps around to the last source
|
||||||
func (widget *MultiSourceWidget) PrevSource() {
|
func (widget *MultiSourceWidget) PrevSource() {
|
||||||
widget.Idx = widget.Idx - 1
|
widget.Idx--
|
||||||
if widget.Idx < 0 {
|
if widget.Idx < 0 {
|
||||||
widget.Idx = len(widget.Sources) - 1
|
widget.Idx = len(widget.Sources) - 1
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user