From e16b1884fca0201fb8d23915b8eb8167f9ad1568 Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Fri, 13 Feb 2026 11:48:25 -0800 Subject: [PATCH] container: hledger-flow: trezor: add uniform quotes - Allows undesirable characters in variable-text columns - Related refactoring --- .../accounts/trezor/trezor-shared.bash | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/container/src/hledger-flow/accounts/trezor/trezor-shared.bash b/container/src/hledger-flow/accounts/trezor/trezor-shared.bash index 472aa28..5962d2c 100755 --- a/container/src/hledger-flow/accounts/trezor/trezor-shared.bash +++ b/container/src/hledger-flow/accounts/trezor/trezor-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 @@ -45,7 +45,10 @@ function parse() _subaccount="$(echo $global_in_filename | cut -d'_' -f1)" # NOTE: subaccount (account label) is entered within the app - gawk -v global_year="$global_year" -v global_subaccount="$global_subaccount" -v subaccount="$_subaccount" \ + gawk \ + -v global_year="$global_year" \ + -v global_subaccount="$global_subaccount" \ + -v subaccount="$_subaccount" \ '{ if (NR<2) next @@ -55,9 +58,6 @@ function parse() if (date !~ global_year) next - # Be rid of commas for OFS sake - gsub(/,/, "-") - # Timestamp provides UTC. UTC is used even though Time provides # local timezone because fetching outside of the app provides UTC printf date OFS # Timestamp @@ -70,16 +70,18 @@ function parse() printf $5 OFS # Transaction ID printf $6 OFS # Fee - printf $7 OFS # Fee unit + printf "\"" $7 "\"" OFS # Fee unit printf $8 OFS # Address + # Label sub(/%/, "%%", $9) - printf $9 OFS # Label + gsub(/"/, "", $9) + printf "\"" $9 "\"" OFS printf("%.8f", $10); printf OFS # Amount # TODO: more than 8 places for Ethereum, etc.? - printf $11 OFS # Amount unit - printf $12 OFS # Fiat (USD) - printf $13 OFS # Other + printf "\"" $11 "\"" OFS # Amount unit + printf "\"" $12 "\"" OFS # Fiat (USD) + printf "\"" $13 "\"" OFS # Other printf direction OFS printf global_subaccount":"subaccount