diff --git a/summary.go b/summary.go index f8faa19..8c82598 100644 --- a/summary.go +++ b/summary.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "os" "time" "code.gitea.io/sdk/gitea" @@ -41,10 +42,14 @@ func (m summaryviewer) View() string { } func summary() { + finished := false p := tea.NewProgram(initialIndicator(("Fetching time logs..."))) go func() { if _, err := p.Run(); err != nil { - panic("An error occured.") + fmt.Println(err) + } + if !finished { + os.Exit(1) } }() @@ -61,9 +66,10 @@ func summary() { viewer.total_time += time.Duration(t.Time * int64(time.Second)) } + finished = true p.Send(IndicatorInfo{info: "Done", quitting: true}) - p.RestoreTerminal() p.Quit() + p.Wait() program := tea.NewProgram(viewer) if _, err := program.Run(); err != nil {