support targeting specific date
This commit is contained in:
@@ -5,16 +5,22 @@ import (
|
||||
"log/slog"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Run() error {
|
||||
func Run(targetDate *time.Time) error {
|
||||
snapshotDir, snapshotDate, err := FindLatestDailySnapshot()
|
||||
if err != nil {
|
||||
return fmt.Errorf("finding latest snapshot: %w", err)
|
||||
}
|
||||
slog.Info("found latest daily snapshot", "dir", snapshotDir, "snapshot_date", snapshotDate.Format("2006-01-02"))
|
||||
|
||||
targetDay := snapshotDate.AddDate(0, 0, -1)
|
||||
var targetDay time.Time
|
||||
if targetDate != nil {
|
||||
targetDay = *targetDate
|
||||
} else {
|
||||
targetDay = snapshotDate.AddDate(0, 0, -1)
|
||||
}
|
||||
slog.Info("target day for extraction", "date", targetDay.Format("2006-01-02"))
|
||||
|
||||
// Check if output already exists
|
||||
|
||||
Reference in New Issue
Block a user