fix: spin timeout

This commit is contained in:
Maas Lalani 2023-06-30 09:16:58 -04:00
parent 65c4d53cae
commit 90f8a4aeae
No known key found for this signature in database
GPG key ID: 5A6ED5CBF1A0A000

View file

@ -19,6 +19,7 @@ import (
"strings"
"time"
"github.com/charmbracelet/gum/internal/exit"
"github.com/charmbracelet/gum/timeout"
"github.com/charmbracelet/bubbles/spinner"
@ -86,7 +87,7 @@ func (m model) View() string {
}
var header string
if m.align == "left" {
header = m.spinner.View() + " " + m.title + str
header = m.spinner.View() + str + " " + m.title
} else {
header = str + " " + m.title + " " + m.spinner.View()
}
@ -101,7 +102,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
switch msg := msg.(type) {
case timeout.TickTimeoutMsg:
if msg.TimeoutValue <= 0 {
m.status = 130
m.status = exit.StatusAborted
return m, tea.Quit
}
m.timeout = msg.TimeoutValue