From 3764376bfaba17237ad1dec95d9f1123db85d593 Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Fri, 13 Feb 2026 11:05:13 -0800 Subject: [PATCH] container: hledger-flow: electrum: add uniform quotes - Allows undesirable characters in variable-text columns - Related refactoring --- .../accounts/electrum/electrum-shared.bash | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/container/src/hledger-flow/accounts/electrum/electrum-shared.bash b/container/src/hledger-flow/accounts/electrum/electrum-shared.bash index 9132bea..dc34f84 100755 --- a/container/src/hledger-flow/accounts/electrum/electrum-shared.bash +++ b/container/src/hledger-flow/accounts/electrum/electrum-shared.bash @@ -2,7 +2,7 @@ # docker-finance | modern accounting for the power-user # -# Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) +# Copyright (C) 2021-2026 Aaron Fiore (Founder, Evergreen Crypto LLC) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -39,7 +39,9 @@ function parse_without-lightning-header() { lib_preprocess::assert_header "transaction_hash,label,confirmations,value,fiat_value,fee,fiat_fee,timestamp" - gawk -v global_year="$global_year" -v global_subaccount="$global_subaccount" \ + gawk --csv \ + -v global_year="$global_year" \ + -v global_subaccount="$global_subaccount" \ '{ if (NR<2 || $8 !~ global_year) next @@ -61,7 +63,7 @@ function parse_without-lightning-header() # sub(/%/, "%%", $2) - printf $2 OFS + printf "\""; printf $2; printf "\"" OFS # # confirmations @@ -128,7 +130,7 @@ function parse_without-lightning-header() printf "\n" - }' FS=, OFS=, "$global_in_path" >"$global_out_path" + }' OFS=, "$global_in_path" >"$global_out_path" } # Since electrum 4.6.2 @@ -137,7 +139,9 @@ function parse_with-lightning-header() { lib_preprocess::assert_header "oc_transaction_hash,ln_payment_hash,label,confirmations,amount_chain_bc,amount_lightning_bc,fiat_value,network_fee_satoshi,fiat_fee,timestamp" - gawk -v global_year="$global_year" -v global_subaccount="$global_subaccount" \ + gawk --csv \ + -v global_year="$global_year" \ + -v global_subaccount="$global_subaccount" \ '{ if (NR<2 || $10 !~ global_year) next @@ -159,7 +163,7 @@ function parse_with-lightning-header() # sub(/%/, "%%", $3) - printf $3 OFS + print "\""; printf $3; printf "\"" OFS # # confirmations @@ -254,7 +258,7 @@ function parse_with-lightning-header() printf "\n" - }' FS=, OFS=, "$global_in_path" >"$global_out_path" + }' OFS=, "$global_in_path" >"$global_out_path" } function main()