refactor(times): Handle 'since' option before starting bubble tea indicator
This commit is contained in:
parent
c5b82d5dbe
commit
df48225954
12
times.go
12
times.go
@ -15,6 +15,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func times() {
|
func times() {
|
||||||
|
since, err := tparse.AddDuration(time.Now(), "-"+*arguments.Times.since)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Failed to parse time string '%s'\n", *arguments.Times.since)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
finished := false
|
finished := false
|
||||||
p := tea.NewProgram(initialIndicator("Fetching time logs..."))
|
p := tea.NewProgram(initialIndicator("Fetching time logs..."))
|
||||||
go func() {
|
go func() {
|
||||||
@ -27,12 +33,6 @@ func times() {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
since, err := tparse.AddDuration(time.Now(), "-"+*arguments.Times.since)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("Failed to parse time string '%s'\n", *arguments.Times.since)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
times := getTimeLogs(since, func(repo gitea.Repository, took time.Duration) {
|
times := getTimeLogs(since, func(repo gitea.Repository, took time.Duration) {
|
||||||
p.Send(IndicatorInfo{
|
p.Send(IndicatorInfo{
|
||||||
info: fmt.Sprintf("%s / %s", repo.Owner.UserName, repo.Name),
|
info: fmt.Sprintf("%s / %s", repo.Owner.UserName, repo.Name),
|
||||||
|
Loading…
Reference in New Issue
Block a user