From fccf994e2f925422629348472d88c168ab5008a4 Mon Sep 17 00:00:00 2001 From: Shane Huston Date: Wed, 8 Jun 2022 12:36:31 +0100 Subject: [PATCH] Handle unspecified input files --- transactions/process.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/transactions/process.go b/transactions/process.go index b9a8f7d..dd05408 100644 --- a/transactions/process.go +++ b/transactions/process.go @@ -10,11 +10,15 @@ func Process(revolutFile string, aibFile string, startDate time.Time) { fmt.Println("Excluding transactions on and before ", startDate) report := NewReport(startDate) - revolutLines := utils.ReadInputFile(revolutFile) - aibLines := utils.ReadInputFile(aibFile) + if revolutFile != "" { + revolutLines := utils.ReadInputFile(revolutFile) + report = report.AddTransactions(revolutLines, true) + } - report = report.AddTransactions(revolutLines, true) - report = report.AddTransactions(aibLines, false) + if aibFile != "" { + aibLines := utils.ReadInputFile(aibFile) + report = report.AddTransactions(aibLines, false) + } report.Sort() report.Output()