Merge pull request #144 into master

a14dfae README: update to latest `gen` impl (Aaron Fiore)
e6ccd96 client: completion: add `gen` arguments (Aaron Fiore)
f2102c7 client: src: lib_gen: reduce prompt language verbosity (Aaron Fiore)
169034c client: src: lib_gen: refactor/update editor related (Aaron Fiore)
52270ba container: rename $global_conf_shell -> $global_conf_subscript (Aaron Fiore)
0ec42d2 client: rename $global_shell_file -> $global_superscript (Aaron Fiore)
51bf587 client/container: rename 'subprofile' script to 'subscript' (Aaron Fiore)
c8d99e3 client: docker-finance.d: superscript: remove unused tag (Aaron Fiore)
f96dae0 client: src: lib_gen: impl overhaul for new args (Aaron Fiore)
e850938 client: src: lib_gen: add args and args parsing (Aaron Fiore)
9f6ad19 client: src: lib_gen: move hledger conf to subprofile gen (Aaron Fiore)
c3cf815 client: src: refactor system checks (Aaron Fiore)
d8222c6 client: src: refactor environment/gen handler (Aaron Fiore)
This commit was merged in pull request #144.
This commit is contained in:
2024-09-23 17:49:35 -07:00
11 changed files with 1112 additions and 667 deletions

View File

@@ -329,9 +329,10 @@ Supported blockchains (independent of wallet type):
The following will generate your Docker-related client/container environment for the default image (see [Environment Generation](#environment-generation) for details):
```bash
dfi archlinux/${USER}:default gen
dfi archlinux/${USER}:default gen all=all
```
> If you would like to use the `ubuntu` image, replace `archlinux` with `ubuntu` here and for all remaining steps
> To regenerate any step in this process, now or in the future, use `gen help` for available options
> To use the `ubuntu` image instead, replace `archlinux` with `ubuntu` here and for all remaining steps
7. **Build default `docker-finance` image**:
```bash
@@ -349,7 +350,7 @@ Supported blockchains (independent of wallet type):
10. (Optional) **Developers: on your client (host), build and setup the `dev-tools` platform**:
```bash
dfi dev-tools/${USER}:default build type=default && dfi dev-tools/${USER}:default gen
dfi dev-tools/${USER}:default build type=default && dfi dev-tools/${USER}:default gen all=all
```
### Environment Generation
@@ -371,7 +372,7 @@ You'll create these files (and more) when running client (host) command `gen`, a
When running `gen`, you'll see the following:
> *Client-side environment found, backup then generate new one?*
> *Client environment file found, backup then generate new one? [Y/n]*
Generates the client (host) configuration file (see the [Client (Host) Configuration File](#client-host-configuration) for details).
@@ -384,22 +385,21 @@ Generates custom Dockerfile. Do as you wish; install your own container packages
- To easily edit this configuration file after `gen` is complete, run client (host) command `edit type=build`
> *Generate joint client/container superscript? [Y/n]*
Select 'y' if this is your first-run for the given platform and tag, or if you need to regenerate the file (see [Superscript](#clientcontainer-superscript) for details).
---
#### Container Generation
After the previous client environment is generated, the following will prepare the container environment (everything you'll need while inside `docker-finance`).
> *Generate (or update) container flow (profiles, etc.)?*
> *Generate container finance flow (layout and profiles)? [Y/n]*
Although the container environment is a minimum requirement, here you'll have the option to continue generating or to backup a previous install.
Not limited to `hledger-flow` data, this option leads to generating the layout and files needed for processing *all* `docker-finance` end-user generated data (journals, configurations, etc.).
> *Will this profile be used for development and/or demonstration?*
If you're a developer or wish to see the mockup test profile, select 'y' here.
It should be noted that:
- mockup data can be found in the `mockup` directories within this repository
Although the container environment is a minimum requirement, here you'll have the option to continue generation.
> *Enter profile name (e.g., family in 'family/alice')*
> *Enter subprofile name (e.g., alice in 'family/alice')*
@@ -410,42 +410,30 @@ It should be noted that:
- all subsequent questions and container generation will relate to this `profile/subprofile` pairing
- all output will be sent to the `${DOCKER_FINANCE_CONTAINER_FLOW}/profiles/profile/subprofile` path
> *Generate (or update) joint client/container shell script (superscript)? [Y/n]*
Select 'y' if this a first-run. If this is not a first-run but you need to regenerate the file, then select 'y' (see [Superscript](#clientcontainer-superscript) for details).
> *Generate (or update) hledger configuration file?*
If the container's version of hledger supports it, use this customizable configuration file.
> *Generate (or update) container flow configs and/or accounts?*
Not limited to `hledger-flow` data, this option leads to generating the layout and files needed for processing *all* `docker-finance` end-user generated data (journals, configurations, etc.).
> *Generate (or update) subprofile's shell script?*
> *Generate subprofile's subscript file? [Y/n]*
The container's subprofile's shell script is where all subprofile commands and aliases exist.
This file is generated on a per-subprofile basis and all custom code *on a per-subprofile basis* should go here (see [Subprofile](#subprofile) for details).
This file is generated on a per-subprofile basis and all custom code *on a per-subprofile basis* should go here (see [Subscript](#subscript) for details).
> *Generate (or update) subprofile's fetch configuration?*
> *Generate subprofile's fetch configuration file? [Y/n]*
The container's fetch configuration is what all remote fetching relies on: prices, exchanges, blockchain explorers; all are configured here (see [Fetch](#fetch-1) for details).
> *Generate (or update) subprofile's financial metadata?*
> *Generate subprofile's financial metadata file? [Y/n]*
The container's *per-subprofile* metadata file.
This file contains all your custom metadata and can edited with the `edit` and analyzed with the `meta` or `root` command (see [Meta](#meta) for details).
> *Generate (or update) subprofile's hledger-flow accounts?*
> *Generate subprofile's hledger configuration file? [Y/n]*
This configuration file is specific to `hledger`. See `hledger` documentation for options.
> *Generate subprofile's hledger-flow accounts? [Y/n]*
The container's `hledger-flow` accounts to be installed. These are the accounts described in [What is supported?](#what-is-supported).
> *Generate individual subprofile accounts instead of generating them all at once?*
If you intend to only use a few accounts, you can do so here. Otherwise, generate all accounts (recommended).
**WARNING**: if you plan to use blockchain-based wallets (coinbase-wallet, pera-wallet, ledger, metamask, etc.), you **MUST** generate their respective chains, as seen during generation (`algorand`, `ethereum-based`, `tezos`, etc).
### Configuration Files
@@ -639,7 +627,7 @@ After `gen` is complete, you can edit this file with the client (host) command:
The client/container shell script (Superscript) is a bind-mounted (by directory) script that:
- is the intermediary between client and container
- is unique to each client (host) user (/home/alice, /home/bob, etc.)
- is the glue that ties together **all** container [Subprofile](#subprofile) scripts
- is the glue that ties together **all** container [Subscript](#subscript)
- is generated on a per-client basis: all custom code on a **per-client basis** should go here
See the in-file comments for further documentation:
@@ -654,15 +642,15 @@ After `gen` is complete, you can edit this file with the client (host) command:
These configurations are confined solely to the container.
##### *Subprofile*
##### *Subscript*
The Subprofile script is unique to each subprofile for each `profile/subprofile` within the `profiles` parent directory.
The Subprofile's subscript is unique to each subprofile, for each `profile/subprofile` within the `profiles` parent directory.
By default, this file will contain user aliases for all container commands. These aliases are mostly useful for small setups or setups with uniquely named subprofiles among all profiles.
See the in-file comments for further documentation:
- [subprofile.bash.in](client/docker-finance.d/container/shell/subprofile.bash.in)
- [subscript.bash.in](client/docker-finance.d/container/shell/subscript.bash.in)
After `gen` is complete, from within the container, you can edit this file with: `dfi profile/subprofile edit type=shell` (see [Container Command Format](#container-command-format)).
@@ -771,7 +759,7 @@ Assuming `<profile/subprofile>` is `testprofile/testuser`:
dfi testprofile/testuser fetch help
```
Or, use a subprofile alias, as described in [Subprofile](#subprofile):
Or, use a subprofile alias, as described in [Subscript](#subscript):
```bash
testuser_fetch help
@@ -909,8 +897,11 @@ For other dependencies, please see their individual contributing guidelines.
You'll greatly benefit from building the [`dev-tools` image](#image-dev-tools), as seen in `docker-finance help`.
Additionally, when developing with the [`docker-finance` image](#image-docker-finance), please test your work with mockups as described in [Environment Generation](#environment-generation) and [Flow Layout](#flow-layout).
> Note: mockup CSVs will *intentionally* have multiple years within in a `1-in/year` directory in order to test for year parsing.
Additionally, when developing with the [`docker-finance` image](#image-docker-finance) create a development profile with the `gen` command argument `dev=on`. From there, you'll have access to mockup CSVs as described in [Flow Layout](#flow-layout).
> - In addition to `dev=on`, run the `confirm=off` and `profile=` arguments to quickly spin-up a new development profile
> - Developer mockup CSVs can be found in the `mockup` directories within the hledger-flow section of this repository
> - Developer mockup CSVs will *intentionally* have multiple years within in a `1-in/year` directory in order to test for year parsing
#### Plugins

View File

@@ -20,7 +20,7 @@
# docker-finance @DOCKER_FINANCE_VERSION@
#
# Subprofile script
# Subscript (subprofile script) called by superscript
#
[ -z "$DOCKER_FINANCE_CONTAINER_CMD" ] && echo "DOCKER_FINANCE_CONTAINER_CMD not set, check installation" >&2

View File

@@ -40,7 +40,6 @@ alias c='clear' # or ctrl+l
alias e='exit'
alias grep='grep --color=auto'
# All subprofiles' scripts
@DOCKER_FINANCE_SUBPROFILE_SOURCE@
# All subprofiles' subscripts are appended below
# vim: syn=bash sw=2 sts=2 si ai et

View File

@@ -73,7 +73,7 @@ function docker-finance::completion()
case "$_prev" in
gen)
# TODO: _currently no-op
mapfile -t _reply < <(compgen -W "help all${global_arg_delim_2} type${global_arg_delim_2} profile${global_arg_delim_2} config${global_arg_delim_2} account${global_arg_delim_2} dev${global_arg_delim_2} confirm${global_arg_delim_2}" -- "$_cur")
;;
edit)
mapfile -t _reply < <(compgen -W "help type${global_arg_delim_2}" -- "$_cur")

View File

@@ -58,7 +58,7 @@ function lib_docker::__docker()
[ -z "$global_platform" ] && lib_utils::die_fatal
[ -z "$global_tag" ] && lib_utils::die_fatal
# Inherited from caller (via lib_gen)
# Inherited from caller (via `lib_env`)
[ -z "$global_client_version" ] && lib_utils::die_fatal
[ -z "$global_repo_dockerfiles" ] && lib_utils::die_fatal
@@ -561,11 +561,11 @@ function lib_docker::__edit()
[ -z "$global_env_file" ] && lib_utils::die_fatal
[ ! -f "$global_env_file" ] \
&& lib_utils::die_fatal "Environment file now found"
&& lib_utils::die_fatal "Environment file not found"
[ -z "$global_shell_file" ] && lib_utils::die_fatal
[ ! -f "$global_shell_file" ] \
&& lib_utils::die_fatal "Shell (superscript) file now found"
[ -z "$global_superscript" ] && lib_utils::die_fatal
[ ! -f "$global_superscript" ] \
&& lib_utils::die_fatal "Shell (superscript) file not found"
# Run all files through one editor instance
local _paths=()
@@ -581,7 +581,7 @@ function lib_docker::__edit()
[[ "$global_platform" == "dev-tools" ]] \
&& lib_utils::die_fatal "Invalid platform, use finance image"
_paths+=("$global_shell_file")
_paths+=("$global_superscript")
;;
build | dockerfile)
[ -z "$global_custom_dockerfile" ] && lib_utils::die_fatal

View File

@@ -0,0 +1,311 @@
#!/usr/bin/env bash
# docker-finance | modern accounting for the power-user
#
# Copyright (C) 2021-2024 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && exit 1
#
# "Libraries"
#
# Utilities (a container library (but container is never exposed to client code))
source "${DOCKER_FINANCE_CLIENT_REPO}/container/src/finance/lib/internal/lib_utils.bash" || exit 1
#
# Implementation
#
if [ $UID -lt 1000 ]; then
lib_utils::die_fatal "Do not run as root or system user!"
fi
# Dependencies
deps=("sed")
lib_utils::deps_check "${deps[@]}"
# IMPORTANT: keep umask for security
umask o-rwx
#
# "Constructor" for environment generation
#
# 1. Sets client-side environment with defaults or use existing environment
# 2. If configured, resets to alternative environment configuration after bootstrap
#
# NOTE: some bootstrapped defaults are ignored by environment file (as seen below)
#
function lib_env::env()
{
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && lib_utils::die_fatal
# NOTE: global_* *MUST* be reset after sourcing new env file
#
# Generate `docker-finance` version
#
global_repo_manifest="${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.yaml"
declare -g global_repo_manifest
global_client_version="$(grep '^version: ' $global_repo_manifest | sed -e 's/version: "//' -e 's/"//g')"
# shellcheck disable=SC2034 # used during env gen
declare -g global_client_version
#
# If empty environment:
#
# 1. Poke at possible (default) location of end-user environment file
# a. If found, point to new location and read/reset from there
#
# 2. If file not found, bootstrap with defaults
#
# Environment (end-user)
global_conf_filename="${USER}@$(uname -n)"
declare -g global_conf_filename
# Environment (end-user) tag dir (not full path)
[ -z "$global_tag" ] && lib_utils::die_fatal
global_tag_dir="client/$(uname -s)-$(uname -m)/${global_platform}/${global_tag}"
declare -g global_tag_dir
local _env_dir="/home/${USER}/.config/docker-finance.d/${global_tag_dir}/env" # NOTE: keep aligned with gen.bash
local _env_file="${_env_dir}/${global_conf_filename}"
# shellcheck source=/dev/null
[ -f "$_env_file" ] && source "$_env_file"
if [ -z "$DOCKER_FINANCE_CLIENT_CONF" ]; then
# shellcheck source=/dev/null
source "${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.d/client/env/gen.bash"
fi
[ -z "$DOCKER_FINANCE_CLIENT_CONF" ] \
&& lib_utils::die_fatal "Defaults not generated! (${global_repo_env_file})"
lib_env::__set_client_globals
#
# Reset environment with user-provided (user-defined) existing file (if available)
#
_env_dir="${DOCKER_FINANCE_CLIENT_CONF}/${global_tag_dir}/env"
_env_file="${_env_dir}/${global_conf_filename}"
if [ -f "$_env_file" ]; then
if [ -s "$_env_file" ]; then
# Re-bootstrap with (new) environment
lib_utils::print_debug "Environment found! Using '${_env_file}'"
lib_env::__read "$_env_file"
lib_env::__set_client_globals
else
lib_utils::print_warning \
"Client environment '${_env_file}' is empty! Writing defaults"
lib_env::__write "$_env_file"
fi
else
[ -z "$global_command" ] && lib_utils::die_fatal
[ -z "$global_basename" ] && lib_utils::die_fatal
if [[ -z "$global_command" || "$global_command" != "gen" ]]; then
lib_utils::die_fatal \
"Client environment not found! Run gen command'"
fi
lib_utils::print_info \
"Client environment not found, writing defaults to '${_env_file}'"
lib_env::__write "$_env_file"
fi
}
#
# Set client globals from environment
#
function lib_env::__set_client_globals()
{
lib_utils::print_debug "Setting (or resetting) client globals"
#
# Repository env
#
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && lib_utils::die_fatal
# Generate `docker-finance` version
global_repo_manifest="${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.yaml"
declare -g global_repo_manifest
lib_utils::print_debug "global_repo_manifest=${global_repo_manifest}"
global_client_version="$(grep '^version: ' $global_repo_manifest | sed -e 's/version: "//' -e 's/"//g')"
# shellcheck disable=SC2034 # used during env gen
declare -g global_client_version
lib_utils::print_debug "global_client_version=${global_client_version}"
# This does not reset when reading env; export again
export DOCKER_FINANCE_VERSION="$global_client_version"
lib_utils::print_debug "DOCKER_FINANCE_VERSION=${DOCKER_FINANCE_VERSION}"
# Repository-provided (not user-defined) default environment
global_repo_conf_dir="${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.d"
declare -g global_repo_conf_dir
lib_utils::print_debug "global_repo_conf_dir=${global_repo_conf_dir}"
# Environment (repo)
declare -g global_repo_env_file="${global_repo_conf_dir}/client/env/gen.bash"
[ ! -f "$global_repo_env_file" ] \
&& lib_utils::die_fatal "Missing environment defaults! ($global_repo_env_file)"
lib_utils::print_debug "global_repo_env_file=${global_repo_env_file}"
#
# Repository env (Dockerfiles)
#
# Set image type
[ -z "$global_platform" ] && lib_utils::die_fatal
case "$global_platform" in
archlinux | ubuntu)
global_platform_image="finance"
;;
dev-tools)
global_platform_image="dev-tools"
;;
*)
lib_utils::die_fatal "unsupported platform"
;;
esac
declare -g global_platform_image
lib_utils::print_debug "global_platform_image=${global_platform_image}"
# Base location of Docker-related files (.in and final out files)
global_repo_dockerfiles="${DOCKER_FINANCE_CLIENT_REPO}/client/Dockerfiles/local/${global_platform_image}"
# shellcheck disable=SC2034 # used in lib_docker
declare -g global_repo_dockerfiles
lib_utils::print_debug "global_repo_dockerfiles=${global_repo_dockerfiles}"
# Base custom end-user .in Dockerfile (to be appended to final Dockerfile after installation)
declare -g global_repo_custom_dockerfile="${global_repo_conf_dir}/client/Dockerfiles/${global_platform_image}/Dockerfile.${global_platform}.in"
[ ! -f "$global_repo_custom_dockerfile" ] \
&& lib_utils::die_fatal "Missing default custom Dockerfile '${global_repo_custom_dockerfile}'"
lib_utils::print_debug "global_repo_custom_dockerfile=${global_repo_custom_dockerfile}"
#
# Client-side env
#
[ -z "$global_tag_dir" ] && lib_utils::die_fatal
# Environment (end-user) format
[ -z "$DOCKER_FINANCE_USER" ] && lib_utils::die_fatal
global_conf_filename="${DOCKER_FINANCE_USER}@$(uname -n)"
declare -g global_conf_filename
lib_utils::print_debug "global_conf_filename=${global_conf_filename}"
# Environment file (if available)
local _client_env_dir="${DOCKER_FINANCE_CLIENT_CONF}/${global_tag_dir}/env"
[ ! -d "$_client_env_dir" ] && mkdir -p "$_client_env_dir"
global_env_file="${_client_env_dir}/${global_conf_filename}"
lib_utils::print_debug "global_env_file=${global_env_file}"
# Custom Dockerfile (if available)
local _client_dockerfile_dir="${DOCKER_FINANCE_CLIENT_CONF}/${global_tag_dir}/Dockerfiles"
[ ! -d "$_client_dockerfile_dir" ] && mkdir -p "$_client_dockerfile_dir"
global_custom_dockerfile="${_client_dockerfile_dir}/${global_conf_filename}"
lib_utils::print_debug "global_custom_dockerfile=${global_custom_dockerfile}"
# NOTE:
#
# Client env tag format is avoided because:
#
# - We copy over static bash_aliases in Dockerfile,
# and superscript must be referenced by that static path
#
# - The needed dynamicness appears to not be satisfied via docker-compose
local _client_shell_dir="${DOCKER_FINANCE_CLIENT_CONF}/container/shell"
[ ! -d "$_client_shell_dir" ] && mkdir -p "$_client_shell_dir"
global_superscript="${_client_shell_dir}/superscript.bash"
lib_utils::print_debug "global_superscript=${global_superscript}"
# Client view of client portion of repository
global_repo_client="${DOCKER_FINANCE_CLIENT_REPO}/client"
[ ! -d "$global_repo_client" ] && lib_utils::die_fatal "Repository '${global_repo_client}' not found!"
lib_utils::print_debug "global_repo_client=${global_repo_client}"
# Backup-file extension
# TODO: make configurable
global_suffix="$(date +%Y-%m-%d_%H:%M:%S)"
lib_utils::print_debug "global_suffix=${global_suffix}"
}
#
# Get/Set client-side environment with given file
#
function lib_env::__read()
{
local _file="$1"
# Get environment
local _env=()
while read _line; do
_env+=("$_line")
done < <(printenv | grep -Eo "^DOCKER_FINANCE[^=]+")
# Reset environment
for _line in "${_env[@]}"; do
lib_utils::print_debug "Unsetting $_line"
unset "$_line"
done
# Set, if a script that generates env
if [[ "$(head -n1 $_file)" =~ (bin|env|sh|bash) ]]; then
# shellcheck source=/dev/null
source "$global_repo_env_file"
return $?
fi
# Set, if env file format (docker / bash)
while read _line; do
# Ignore comments
if [[ ! "$_line" =~ ^# ]]; then
# Don't allow manipulating version via file
if [[ "$_line" =~ ^DOCKER_FINANCE_VERSION ]]; then
continue
fi
# Export valid line
export "${_line?}" # SC2163
lib_utils::print_debug "$_line"
fi
done <"$_file"
}
#
# Write client-side environment to given file
#
function lib_env::__write()
{
lib_utils::print_debug "Writing environment"
unset DOCKER_FINANCE_VERSION # Must be generated internally
printenv | grep -E "DOCKER_FINANCE" | sort >"$1"
}
# vim: sw=2 sts=2 si ai et

File diff suppressed because it is too large Load Diff

View File

@@ -26,7 +26,10 @@
# Docker impl
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/internal/lib_docker.bash" || exit 1
# Environment generation
# Runtime environment handler
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/internal/lib_env.bash" || exit 1
# Environment layout generator
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/internal/lib_gen.bash" || exit 1
# Plugins support
@@ -44,14 +47,6 @@ source "${DOCKER_FINANCE_CLIENT_REPO}/container/src/finance/lib/internal/lib_uti
# Implementation
#
if [ $UID -lt 1000 ]; then
lib_utils::die_fatal "Do not run as root or system user!"
fi
# Dependencies
deps=("sed")
lib_utils::deps_check "${deps[@]}"
# Top-level caller
global_basename="$(basename -- $0)"
declare -rx global_basename
@@ -114,8 +109,8 @@ function lib_docker::docker()
declare -gxr global_usage="$global_basename ${global_platform}${global_arg_delim_1}${global_user}:${global_tag} $global_command"
lib_utils::print_debug "global_usage=${global_usage}"
# Setup remaining client/container globals
lib_gen::gen || return $?
# Setup remaining environment globals
lib_env::env || return $?
# Remaining "constructor" implementation
lib_docker::__docker || return $?
@@ -129,7 +124,7 @@ function lib_docker::docker()
function lib_docker::gen()
{
lib_gen::generate
lib_gen::gen "$@"
lib_utils::catch $?
}

View File

@@ -96,7 +96,7 @@ void example2()
print_env("global_conf_fetch");
print_env("global_conf_hledger");
print_env("global_conf_meta");
print_env("global_conf_shell");
print_env("global_conf_subscript");
// TODO(unassigned): read array from shell? ROOT impl simply calls stdlib getenv()
// print_env("global_hledger_cmd");
print_env("global_parent_profile");

View File

@@ -324,14 +324,14 @@ function lib_edit::__edit()
$EDITOR "${_paths[@]}" || lib_utils::die_fatal
;;
shell)
[ -z "$global_conf_shell" ] && lib_utils::die_fatal
[ -z "$global_conf_subscript" ] && lib_utils::die_fatal
local _dir
_dir="$(dirname $global_conf_shell)"
_dir="$(dirname $global_conf_subscript)"
[ ! -d "$_dir" ] && mkdir -p "$_dir"
local _file
_file="$(basename $global_conf_shell)"
_file="$(basename $global_conf_subscript)"
local _path
_path="${_dir}/${_file}"

View File

@@ -80,7 +80,7 @@ function lib_finance::finance()
declare -grx global_conf_fetch="${global_child_profile_flow}/docker-finance.d/fetch/fetch.yaml"
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_shell="${global_child_profile_flow}/docker-finance.d/shell/subprofile.bash"
declare -grx global_conf_subscript="${global_child_profile_flow}/docker-finance.d/shell/subscript.bash"
# Implementation "libraries" (requires previously set globals)
source "${DOCKER_FINANCE_CONTAINER_REPO}/src/finance/lib/internal/lib_edit.bash" || exit 1