container: hledger-flow: lib_preprocess: bash quote given column(s)

when testing header.
This commit is contained in:
2026-03-17 14:06:45 -07:00
parent 484d01aa7a
commit e3598fce8c

View File

@@ -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
@@ -66,7 +66,8 @@ function lib_preprocess::test_header()
local _column="$1"
local _header
_header="$(lib_preprocess::__sanitize_header $2)"
[[ "$_header" =~ (^${_column}$|^${_column},|,${_column},|,${_column}$) ]] && return 0 || return 2
# TODO: add custom delim
[[ "$_header" =~ (^"${_column}"$|^"${_column}",|,"${_column}",|,"${_column}"$) ]] && return 0 || return 2
}
# Assert header in given CSV header