feat: better flags
All checks were successful
Go / build (push) Successful in 38s

This commit is contained in:
2025-11-04 21:15:05 +01:00
parent cfbb475a42
commit e5169ee0c4
11 changed files with 57 additions and 731 deletions

View File

@@ -32,7 +32,11 @@ func FromGiteas(is []*gitea.Issue, mindur time.Duration) []Issue {
func FromGitea(i gitea.Issue) Issue {
issue := Issue{Issue: i}
issue.Duration, _ = ExtractDuration(i.Body)
var err error
issue.Duration, err = ExtractDuration(i.Body)
if err != nil {
issue.Duration = time.Second * 0
}
return issue
}
@@ -43,7 +47,7 @@ func ExtractDuration(text string) (duration time.Duration, err error) {
block := reBlock.FindStringSubmatch(text)
if len(block) < 2 {
err = fmt.Errorf("no info block found")
return
return duration, err
}
// Now extract the duration line from inside that block
@@ -51,7 +55,7 @@ func ExtractDuration(text string) (duration time.Duration, err error) {
match := reDuration.FindStringSubmatch(block[1])
if len(match) < 2 {
err = fmt.Errorf("no duration found inside info block")
return
return duration, err
}
dur := strings.TrimSpace(match[1])
dur = strings.ReplaceAll(dur, "min", "m")