Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ import (

// Config holds CLI flag values to pre-fill the TUI form.
type Config struct {
From string
To string
Date string
Time string
IsArrivalTime bool
NerdFont bool
Theme Theme
CurrentVersion string
From string
To string
Date string
Time string
IsArrivalTime bool
NerdFont bool
DisableCursorBlink bool
Theme Theme
CurrentVersion string
}

// UIConfig groups all UI-related settings.
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func main() {
timeStr := flag.String("time", "", "Pre-fill time [HH:MM]")
arrival := flag.Bool("arrival", false, "Set date/time as arrival instead of departure time")
flag.Bool("nerdfont", true, "Use Nerd Font icons")
cursorBlink := flag.Bool("cursor-blink", true, "Enable terminal cursor blink")
showVersion := flag.BoolP("version", "v", false, "Print version and exit")

// --help
Expand Down Expand Up @@ -74,6 +75,8 @@ func main() {
cfg.NerdFont = nf
}

cfg.DisableCursorBlink = !*cursorBlink

m := ui.NewModel(cfg)

if _, err := tea.NewProgram(m, tea.WithAltScreen()).Run(); err != nil {
Expand Down
11 changes: 8 additions & 3 deletions ui/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ type appModel struct {
inputs []textinput.Model
icons iconSet
styles styles
nerdFont bool
isArrivalTime bool
nerdFont bool
isArrivalTime bool
disableCursorBlink bool
connections []model.Connection
loading bool
errorMsg error
Expand Down Expand Up @@ -94,7 +95,8 @@ func NewModel(cfg config.Config) appModel {
icons: newIconSet(cfg.NerdFont),
styles: newStyles(cfg.Theme),
nerdFont: cfg.NerdFont,
isArrivalTime: cfg.IsArrivalTime,
isArrivalTime: cfg.IsArrivalTime,
disableCursorBlink: cfg.DisableCursorBlink,
currentVersion: cfg.CurrentVersion,
}

Expand Down Expand Up @@ -152,6 +154,9 @@ func NewModel(cfg config.Config) appModel {

// Init implements tea.Model.
func (m appModel) Init() tea.Cmd {
if m.disableCursorBlink {
return checkVersionCmd(m.currentVersion)
}
return tea.Batch(textinput.Blink, checkVersionCmd(m.currentVersion))
}

Expand Down