This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/internal/email"
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice"
|
||||
)
|
||||
@@ -15,6 +16,7 @@ import (
|
||||
type createFlags struct {
|
||||
Email bool `flag:"email" help:"send invoice by email"`
|
||||
Output string `flag:"o" help:"output file"`
|
||||
Label string `flag:"l" help:"filters for issues with the label"`
|
||||
}
|
||||
|
||||
func create(arguments []string, c any) {
|
||||
@@ -33,6 +35,21 @@ func create(arguments []string, c any) {
|
||||
}
|
||||
|
||||
opts := invoice.DefaultOptions
|
||||
|
||||
if flags.Label != "" {
|
||||
opts.IssueState = gitea.StateAll
|
||||
opts.IssueFilter = func(i *gitea.Issue) bool {
|
||||
for _, l := range i.Labels {
|
||||
if l.Name == flags.Label {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
opts.Since = time.Now().AddDate(-1, 0, 0)
|
||||
|
||||
opts.Mindur = time.Duration(req.DurationThreshold)
|
||||
invoice, report, err := invoicer.Generate(req.Creditor, req.Debtor, req.HourlyRate, repos, &opts)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user