mirror of
https://github.com/hibiken/asynq.git
synced 2025-10-03 05:12:01 +08:00
(cli): Define styles in global scope
This commit is contained in:
@@ -64,8 +64,6 @@ type Options struct {
|
|||||||
PollInterval time.Duration
|
PollInterval time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
var baseStyle = tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorReset)
|
|
||||||
|
|
||||||
func Run(opts Options) {
|
func Run(opts Options) {
|
||||||
s, err := tcell.NewScreen()
|
s, err := tcell.NewScreen()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -18,6 +18,11 @@ import (
|
|||||||
"github.com/mattn/go-runewidth"
|
"github.com/mattn/go-runewidth"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
baseStyle = tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorReset)
|
||||||
|
labelStyle = baseStyle.Foreground(tcell.ColorLightGray)
|
||||||
|
)
|
||||||
|
|
||||||
// drawer draws UI with the given state.
|
// drawer draws UI with the given state.
|
||||||
type drawer interface {
|
type drawer interface {
|
||||||
Draw(state *State)
|
Draw(state *State)
|
||||||
@@ -259,7 +264,6 @@ func drawQueueSummary(d *ScreenDrawer, state *State) {
|
|||||||
d.Println("ERROR: Press q to go back", baseStyle)
|
d.Println("ERROR: Press q to go back", baseStyle)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
labelStyle := baseStyle.Foreground(tcell.ColorLightGray)
|
|
||||||
d.Print("Name: ", labelStyle)
|
d.Print("Name: ", labelStyle)
|
||||||
d.Println(q.Queue, baseStyle)
|
d.Println(q.Queue, baseStyle)
|
||||||
d.Print("Size: ", labelStyle)
|
d.Print("Size: ", labelStyle)
|
||||||
|
Reference in New Issue
Block a user