diff --git a/container/src/finance/lib/internal/lib_edit.bash b/container/src/finance/lib/internal/lib_edit.bash index 9f9bbb6..fbee22e 100644 --- a/container/src/finance/lib/internal/lib_edit.bash +++ b/container/src/finance/lib/internal/lib_edit.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 @@ -265,6 +265,7 @@ function lib_edit::__edit() ;; meta) [ -z "$global_conf_meta" ] && lib_utils::die_fatal + [ -z "$global_conf_visidata" ] && lib_utils::die_fatal local _dir _dir="$(dirname $global_conf_meta)" @@ -282,10 +283,10 @@ function lib_edit::__edit() # - If saved to original, opening with `--skip` will clobber the # original file's comments. local -r _skip="$(grep -E "^//!" $_path | wc -l)" - local -r _args=("--quitguard" "--motd-url" "file:///dev/null" "--filetype" "csv" "--skip" "$_skip" "$_path") + local -r _visidata=("--visidata-dir" "$global_conf_visidata" "--quitguard" "--motd-url" "file:///dev/null" "--filetype" "csv" "--skip" "$_skip" "$_path") lib_utils::deps_check "visidata" - visidata "${_args[@]}" || lib_utils::die_fatal + visidata "${_visidata[@]}" || lib_utils::die_fatal # TODO: HACK: visidata saves w/ DOS-style carriage... # ...but there seems to be no option out of this. diff --git a/container/src/finance/lib/internal/lib_hledger.bash b/container/src/finance/lib/internal/lib_hledger.bash index 32e921b..1285ca2 100644 --- a/container/src/finance/lib/internal/lib_hledger.bash +++ b/container/src/finance/lib/internal/lib_hledger.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 @@ -164,9 +164,10 @@ function lib_hledger::__hledger-ui() function lib_hledger::__hledger-vui() { [ -z "${global_base_args[*]}" ] && lib_utils::die_fatal + [ -z "$global_conf_visidata" ] && lib_utils::die_fatal - hledger "${global_base_args[@]}" print -O csv "$@" \ - | visidata --motd-url file:///dev/null --filetype csv + local -r _visidata=("--visidata-dir" "$global_conf_visidata" "--motd-url" "file:///dev/null" "--filetype" "csv") + visidata "${_visidata[@]}" < <(hledger "${global_base_args[@]}" print -O csv "$@") } function lib_hledger::__hledger-web() diff --git a/container/src/finance/lib/internal/lib_meta.bash b/container/src/finance/lib/internal/lib_meta.bash index cd3f9b0..e651d94 100644 --- a/container/src/finance/lib/internal/lib_meta.bash +++ b/container/src/finance/lib/internal/lib_meta.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 @@ -102,6 +102,8 @@ $(echo $global_meta_header | xsv headers -) function lib_meta::__meta() { + [ -z "$global_conf_visidata" ] && lib_utils::die_fatal + lib_utils::deps_check "visidata" # TODO: can visidata regex multiple columns from the commandline? @@ -130,8 +132,8 @@ function lib_meta::__meta() done # Display as stream - cat "$_base_file" \ - | visidata --motd-url file:///dev/null --filetype csv + local -r _visidata=("--visidata-dir" "$global_conf_visidata" "--motd-url" "file:///dev/null" "--filetype" "csv") + visidata "${_visidata[@]}" < <(cat "$_base_file") # Enforce cleanup [ -d "$_tmp_dir" ] && rm -fr "$_tmp_dir" diff --git a/container/src/finance/lib/lib_finance.bash b/container/src/finance/lib/lib_finance.bash index 95793b8..16da9b0 100644 --- a/container/src/finance/lib/lib_finance.bash +++ b/container/src/finance/lib/lib_finance.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 @@ -81,6 +81,7 @@ function lib_finance::finance() declare -grx global_conf_hledger="${global_child_profile_flow}/docker-finance.d/hledger/hledger.conf" declare -grx global_conf_meta="${global_child_profile_flow}/docker-finance.d/meta/meta.csv" declare -grx global_conf_subscript="${global_child_profile_flow}/docker-finance.d/shell/subscript.bash" + declare -grx global_conf_visidata="${global_child_profile_flow}/docker-finance.d/visidata" # dir for config/addons # Implementation "libraries" (requires previously set globals) source "${DOCKER_FINANCE_CONTAINER_REPO}/src/finance/lib/internal/lib_edit.bash" || exit 1