1
0

feat(daemon): timestamps

This commit is contained in:
2024-02-27 02:00:07 +00:00
parent e633fd2e79
commit c909c2a352
7 changed files with 116 additions and 38 deletions

View File

@ -7,6 +7,7 @@ package cmd
import (
"encoding/json"
"fmt"
"time"
"github.com/rs/zerolog/log"
@ -28,10 +29,12 @@ type DaemonJobCmd struct {
}
type DaemonJobsListCmd struct {
Group string `help:"group uuid"`
Repo string `help:"repo name"`
Commit string `help:"commit sha"`
Status string `help:"job status"`
Group string `help:"group uuid"`
Repo string `help:"repo name"`
Commit string `help:"commit sha"`
Status string `help:"job status"`
After time.Time `help:"created after" format:"2006-01-02 15:04:05"`
Before time.Time `help:"created before" format:"2006-01-02 15:04:05"`
}
func (cmd *DaemonJobsListCmd) Run(dm *DaemonCmd, g *Globals) (err error) {
@ -44,6 +47,14 @@ func (cmd *DaemonJobsListCmd) Run(dm *DaemonCmd, g *Globals) (err error) {
Status: api.Status(cmd.Status),
}
if !cmd.After.IsZero() {
params.Time.After = cmd.After.Unix()
}
if !cmd.Before.IsZero() {
params.Time.Before = cmd.Before.Unix()
}
jobs, err := c.Jobs(params)
if err != nil {
log.Error().Err(err).Msg("")