forked from EvergreenCrypto/docker-finance
container: hledger-flow: trezor: add uniform quotes
- Allows undesirable characters in variable-text columns - Related refactoring
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user