container: hledger-flow: lib_preprocess: add custom delim when testing
given header column(s).
This commit is contained in:
@@ -64,10 +64,16 @@ echo -e " \e[32m│ └─\e[37;2m ${global_in_filename}\e[0m"
|
||||
function lib_preprocess::test_header()
|
||||
{
|
||||
local _column="$1"
|
||||
|
||||
local _header
|
||||
_header="$(lib_preprocess::__sanitize_header $2)"
|
||||
# TODO: add custom delim
|
||||
[[ "$_header" =~ (^"${_column}"$|^"${_column}",|,"${_column}",|,"${_column}"$) ]] && return 0 || return 2
|
||||
|
||||
local _delim="$3"
|
||||
[ -z "$_delim" ] && _delim=","
|
||||
|
||||
# TODO: consolidate regexp
|
||||
[[ "$_header" =~ (^"${_column}"$|^"${_column}${_delim}"|"${_delim}${_column}${_delim}"|"${_delim}${_column}"$) ]] \
|
||||
&& return 0 || return 2
|
||||
}
|
||||
|
||||
# Assert header in given CSV header
|
||||
|
||||
Reference in New Issue
Block a user