From 1f657a5d18d1a386f2c3641cdd6a405044229039 Mon Sep 17 00:00:00 2001 From: David Ward Date: Sun, 5 Feb 2023 19:17:05 -0500 Subject: [PATCH] Add missing handling for `-dryrun` flag in command-line client This flag was only handled for the `download-profile` command. Add the same handling for all other commands (except `detect-settings`). --- cmd/ofx/bankdownload.go | 5 +++++ cmd/ofx/banktransactions.go | 5 +++++ cmd/ofx/ccdownload.go | 5 +++++ cmd/ofx/cctransactions.go | 5 +++++ cmd/ofx/get_accounts.go | 5 +++++ cmd/ofx/invdownload.go | 5 +++++ cmd/ofx/invtransactions.go | 5 +++++ 7 files changed, 35 insertions(+) diff --git a/cmd/ofx/bankdownload.go b/cmd/ofx/bankdownload.go index e43a070..8465915 100644 --- a/cmd/ofx/bankdownload.go +++ b/cmd/ofx/bankdownload.go @@ -64,6 +64,11 @@ func download() { query.Bank = append(query.Bank, &statementRequest) + if dryrun { + printRequest(client, query) + return + } + response, err := client.RequestNoParse(query) if err != nil { fmt.Println("Error requesting account statement:", err) diff --git a/cmd/ofx/banktransactions.go b/cmd/ofx/banktransactions.go index 3ce0ddb..70402e5 100644 --- a/cmd/ofx/banktransactions.go +++ b/cmd/ofx/banktransactions.go @@ -49,6 +49,11 @@ func bankTransactions() { query.Bank = append(query.Bank, &statementRequest) + if dryrun { + printRequest(client, query) + return + } + response, err := client.Request(query) if err != nil { fmt.Println("Error requesting account statement:", err) diff --git a/cmd/ofx/ccdownload.go b/cmd/ofx/ccdownload.go index 6effd99..307f118 100644 --- a/cmd/ofx/ccdownload.go +++ b/cmd/ofx/ccdownload.go @@ -51,6 +51,11 @@ func ccDownload() { } query.CreditCard = append(query.CreditCard, &statementRequest) + if dryrun { + printRequest(client, query) + return + } + response, err := client.RequestNoParse(query) if err != nil { diff --git a/cmd/ofx/cctransactions.go b/cmd/ofx/cctransactions.go index 6f989a3..3db9b3f 100644 --- a/cmd/ofx/cctransactions.go +++ b/cmd/ofx/cctransactions.go @@ -38,6 +38,11 @@ func ccTransactions() { } query.CreditCard = append(query.CreditCard, &statementRequest) + if dryrun { + printRequest(client, query) + return + } + response, err := client.Request(query) if err != nil { fmt.Println("Error requesting account statement:", err) diff --git a/cmd/ofx/get_accounts.go b/cmd/ofx/get_accounts.go index 049e8c4..f384e12 100644 --- a/cmd/ofx/get_accounts.go +++ b/cmd/ofx/get_accounts.go @@ -35,6 +35,11 @@ func getAccounts() { } query.Signup = append(query.Signup, &acctInfo) + if dryrun { + printRequest(client, query) + return + } + response, err := client.Request(query) if err != nil { fmt.Println("Error requesting account information:", err) diff --git a/cmd/ofx/invdownload.go b/cmd/ofx/invdownload.go index a3455d2..7a57979 100644 --- a/cmd/ofx/invdownload.go +++ b/cmd/ofx/invdownload.go @@ -60,6 +60,11 @@ func invDownload() { } query.InvStmt = append(query.InvStmt, &statementRequest) + if dryrun { + printRequest(client, query) + return + } + response, err := client.RequestNoParse(query) if err != nil { diff --git a/cmd/ofx/invtransactions.go b/cmd/ofx/invtransactions.go index 05b91a7..c391b9b 100644 --- a/cmd/ofx/invtransactions.go +++ b/cmd/ofx/invtransactions.go @@ -45,6 +45,11 @@ func invTransactions() { } query.InvStmt = append(query.InvStmt, &statementRequest) + if dryrun { + printRequest(client, query) + return + } + response, err := client.Request(query) if err != nil { os.Exit(1)