Skip to content

Commit

Permalink
dd week time span support
Browse files Browse the repository at this point in the history
  • Loading branch information
facundoolano committed Jul 27, 2024
1 parent 0d58f58 commit e333b51
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (

type CommandArgs struct {
Fields []string `arg:"" name:"field" optional:"" enum:"${fields}" help:"Dimensions to aggregate the results. Allowed values: ${fields} "`
Since string `short:"s" default:"1h" help:"Start of the time window to filter logs. Supported units are [s]econds, [m]inutes, [h]ours, [d]ays, [M]onths"`
Until string `short:"u" default:"now" help:"End of the time window to filter logs. Supported units are [s]econds, [m]inutes, [h]ours, [d]ays, [M]onths"`
Since string `short:"s" default:"1h" help:"Start of the time window to filter logs. Supported units are [s]econds, [m]inutes, [h]ours, [d]ays, [w]eeks, [M]onths"`
Until string `short:"u" default:"now" help:"End of the time window to filter logs. Supported units are [s]econds, [m]inutes, [h]ours, [d]ays, [w]eeks, [M]onths"`
Limit int `short:"l" default:"5" help:"Amount of results to return"`
Where []string `short:"w" optional:"" help:"Filter expressions. Example: -w useragent=Safari -w status=200"`
}
Expand Down Expand Up @@ -150,6 +150,8 @@ func parseDuration(duration string) (time.Time, error) {
t = t.Add(-time.Duration(number) * time.Hour)
case "d":
t = t.Add(-time.Duration(number) * time.Hour * 24)
case "w":
t = t.Add(-time.Duration(number) * time.Hour * 24 * 7)
case "M":
t = t.Add(-time.Duration(number) * time.Hour * 24 * 30)
}
Expand Down

0 comments on commit e333b51

Please sign in to comment.