forked from EvergreenCrypto/docker-finance
container: lib_taxes: fix printing for 'all' years
This commit is contained in:
@@ -1001,7 +1001,7 @@ function lib_taxes::__taxes_write()
|
||||
local _current_year
|
||||
_current_year="$(date +%Y)"
|
||||
if [ -z "$global_arg_year" ]; then
|
||||
lib_utils::print_normal "Capturing the year of the oldest tagged record ..."
|
||||
lib_utils::print_info "Capturing the year of the oldest tagged record ...\n"
|
||||
|
||||
local -r _oldest_year="$("${_base_hledger[@]}" | head -n2 | xan select \"date\" | tail -n1 | cut -d'-' -f1)"
|
||||
[ -z "$_oldest_year" ] && lib_utils::die_fatal "No records available to write"
|
||||
@@ -1025,6 +1025,12 @@ function lib_taxes::__taxes_write()
|
||||
[ -z "$global_child_profile_flow" ] && lib_utils::die_fatal
|
||||
for ((_tax_year = ${_oldest_year}; _tax_year <= ${_current_year}; _tax_year++)); do
|
||||
|
||||
if [ -z "$global_arg_year" ]; then
|
||||
lib_utils::print_custom " \e[32m│\e[0m\n"
|
||||
lib_utils::print_info "Generating taxable events in year '${_tax_year}' ..."
|
||||
lib_utils::print_custom " \e[32m│\e[0m\n"
|
||||
fi
|
||||
|
||||
# Final output dir
|
||||
local _tax_root_dir="${global_child_profile_flow}/taxes/${_tax_year}"
|
||||
|
||||
@@ -1047,7 +1053,7 @@ function lib_taxes::__taxes_write()
|
||||
lib_utils::catch $?
|
||||
|
||||
if [[ ! -f "$_out_file" || ! -s "$_out_file" ]]; then
|
||||
lib_utils::print_warning "Nothing generated for '${_arg_tag}' (no taxable event found for the year ${global_arg_year})"
|
||||
lib_utils::print_warning "Nothing generated for '${_arg_tag}' (no taxable event found for the year ${_tax_year})"
|
||||
fi
|
||||
) &
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user