container: src: finance: change visidata default dir

The container environment's $DOCKER_FINANCE_CONTAINER_CONF is
bind-mounted and, by default, points to ~/.config/docker-finance.d

The parent dir (~/.config) is subsequently owned by root (Docker-ism).
Ergo, with visidata v3.2, visidata cannot create its default dir:

    "PermissionError: [Errno 13] Permission denied: for visidata config"

This commit fixes that by setting visidata's default dir to use the
calling profile's docker-finance.d (where profile customization occurs).

Also included is some related refactoring.
This commit is contained in:
2025-06-24 19:32:00 -07:00
parent b80978a026
commit 84ec085b8a
4 changed files with 15 additions and 10 deletions

View File

@@ -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"