From 9380f03b8873659718a44d1aedd9cc52fe491e25 Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Thu, 6 Feb 2025 18:39:19 -0800 Subject: [PATCH] hledger-flow: lib_preprocess: allow testing of single / multiple columns --- container/src/hledger-flow/lib/lib_preprocess.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/container/src/hledger-flow/lib/lib_preprocess.bash b/container/src/hledger-flow/lib/lib_preprocess.bash index 336018e..9a8d7f8 100755 --- a/container/src/hledger-flow/lib/lib_preprocess.bash +++ b/container/src/hledger-flow/lib/lib_preprocess.bash @@ -2,7 +2,7 @@ # docker-finance | modern accounting for the power-user # -# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC) +# Copyright (C) 2021-2025 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 @@ -60,13 +60,13 @@ echo -e " \e[32m├─\e[34m\e[1;3m ${global_account}/${global_subaccount}\e[ echo -e " \e[32m│ └─\e[34;3m ${global_year}\e[0m" echo -e " \e[32m│ └─\e[37;2m ${global_in_filename}\e[0m" -# Search for column in given CSV header +# Test if column(s) exist in given CSV header function lib_preprocess::test_header() { local _column="$1" local _header _header="$(lib_preprocess::__sanitize_header $2)" - [[ "$_header" =~ (^${_column},|,${_column},|,${_column}$) ]] && return 0 || return 2 + [[ "$_header" =~ (^${_column}$|^${_column},|,${_column},|,${_column}$) ]] && return 0 || return 2 } # Assert header in given CSV header