Skip to content

Commit

Permalink
feat(anchor): show idle state for inactive lots
Browse files Browse the repository at this point in the history
  • Loading branch information
streambinder committed Aug 30, 2023
1 parent d55f078 commit 3f43c1b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions util/anchor/lot.go
Expand Up @@ -8,6 +8,10 @@ import (
"github.com/streambinder/spotitube/util"
)

const idle = "idle"

var idleColor = color.New(color.FgWhite)

type lot struct {
anchor
id int
Expand All @@ -33,7 +37,7 @@ func (lot *lot) Printf(format string, a ...any) {
}

func (lot *lot) Wipe() {
lot.Printf("")
lot.Printf(idle)
}

func (lot *lot) Close(messages ...string) {
Expand All @@ -42,5 +46,9 @@ func (lot *lot) Close(messages ...string) {
}

func (lot *lot) write() {
fmt.Print(lot.style.Sprint(formatAlias(lot.alias), lot.data))
dataStyle := lot.style
if lot.data == idle {
dataStyle = idleColor
}
fmt.Print(lot.style.Sprint(formatAlias(lot.alias)), dataStyle.Sprint(lot.data))
}

0 comments on commit 3f43c1b

Please sign in to comment.