support --period
This commit is contained in:
@@ -3,6 +3,7 @@ package cli
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"slices"
|
||||
|
||||
@@ -14,7 +15,7 @@ func Main() {
|
||||
|
||||
fs := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
|
||||
fs.Var(&config.Files, "f", "paths to files")
|
||||
fs.StringVar(&config.Query.Period, "period", "", "period")
|
||||
fs.Var(&config.Query.Period, "period", "period")
|
||||
fs.StringVar(&config.Query.Sort, "S", "", "sort ie date")
|
||||
fs.BoolVar(&config.Query.NoRounding, "no-rounding", false, "no rounding")
|
||||
fs.IntVar(&config.Query.Depth, "depth", 0, "depth grouping")
|
||||
@@ -47,8 +48,14 @@ func Main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if period := config.Query.Period; period != "" {
|
||||
panic(period)
|
||||
if period := config.Query.Period; !period.Empty() {
|
||||
after := period.Start.Format("2006-01-02")
|
||||
before := period.Stop.Format("2006-01-02")
|
||||
deltas = deltas.Like(
|
||||
ledger.LikeAfter(after),
|
||||
ledger.LikeBefore(before),
|
||||
)
|
||||
log.Printf("period=%+v after=%s before=%s", period, after, before)
|
||||
}
|
||||
|
||||
if depth := config.Query.Depth; depth > 0 {
|
||||
|
||||
Reference in New Issue
Block a user