container: lib_edit: add hledger conf support

This commit is contained in:
2024-07-05 21:57:39 -07:00
parent c2ac298f67
commit adebadbaa9
2 changed files with 10 additions and 2 deletions

View File

@@ -59,7 +59,7 @@ function lib_edit::__parse_args()
Configuration type:
type${global_arg_delim_2}<fetch|manual|meta|shell|rules|preprocess>
type${global_arg_delim_2}<fetch|hledger|manual|meta|shell|rules|preprocess>
Account:
@@ -70,6 +70,9 @@ function lib_edit::__parse_args()
\e[37;2m# Edit fetch configuration\e[0m
$ $global_usage type${global_arg_delim_2}fetch
\e[37;2m# Edit hledger configuration\e[0m
$ $global_usage type${global_arg_delim_2}hledger
\e[37;2m# Edit meta and subprofile configurations\e[0m
$ $global_usage type${global_arg_delim_2}meta${global_arg_delim_3}shell
@@ -157,7 +160,7 @@ function lib_edit::__parse_args()
read -ra _read <<<"$_arg_type"
for _type in "${_read[@]}"; do
if [[ ! "$_type" =~ ^fetch$|^iadd$|^manual$|^meta$|^preprocess$|^rules$|^shell$ ]]; then
if [[ ! "$_type" =~ ^fetch$|^hledger$|^iadd$|^manual$|^meta$|^preprocess$|^rules$|^shell$ ]]; then
lib_utils::die_usage "$_usage"
fi
if [[ ! -z "$_arg_account" ]]; then
@@ -201,6 +204,7 @@ function lib_edit::__edit()
[ -z "$global_child_profile" ] && lib_utils::die_fatal
[ -z "$global_child_profile_flow" ] && lib_utils::die_fatal
[ -z "$global_conf_fetch" ] && lib_utils::die_fatal
[ -z "$global_conf_hledger" ] && lib_utils::die_fatal
[ -z "$global_conf_meta" ] && lib_utils::die_fatal
[ -z "$global_conf_shell" ] && lib_utils::die_fatal
@@ -209,6 +213,9 @@ function lib_edit::__edit()
fetch)
$EDITOR "$global_conf_fetch"
;;
hledger)
$EDITOR "$global_conf_hledger"
;;
iadd | manual)
local _path="${global_child_profile_flow}/import/${global_child_profile}/_manual_/${global_arg_year}"
[ ! -d "$_path" ] && mkdir -p "$_path"

View File

@@ -78,6 +78,7 @@ function lib_finance::finance()
# Globals (configuration)
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"