forked from EvergreenCrypto/docker-finance
Merge pull request #280 into master
bd6e3c2fcontainer: lib_hledger: make error fatal if `hledger-web` cannot start (Aaron Fiore)1c6b4493container: lib_hledger: only feed `visidata` on valid `hledger` command (Aaron Fiore)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
# docker-finance | modern accounting for the power-user
|
||||
#
|
||||
# Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC)
|
||||
# Copyright (C) 2021-2026 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
|
||||
@@ -167,7 +167,12 @@ function lib_hledger::__hledger-vui()
|
||||
[ -z "$global_conf_visidata" ] && lib_utils::die_fatal
|
||||
|
||||
local -r _visidata=("--visidata-dir" "$global_conf_visidata" "--motd-url" "file:///dev/null" "--filetype" "csv")
|
||||
visidata "${_visidata[@]}" < <(hledger "${global_base_args[@]}" print -O csv "$@")
|
||||
local -r _hledger=("hledger" "${global_base_args[@]}" "print" "-O" "csv" "$@")
|
||||
|
||||
# If hledger command is valid, output into visidata
|
||||
if "${_hledger[@]}" 1>/dev/null; then
|
||||
visidata "${_visidata[@]}" < <("${_hledger[@]}")
|
||||
fi
|
||||
}
|
||||
|
||||
function lib_hledger::__hledger-web()
|
||||
@@ -183,7 +188,7 @@ function lib_hledger::__hledger-web()
|
||||
sleep 3s
|
||||
|
||||
if ! ps -p "$_pid" 1>/dev/null; then
|
||||
lib_utils::print_error "hledger-web failed. See above error message"
|
||||
lib_utils::die_fatal "hledger-web failed. See above error message"
|
||||
else
|
||||
lib_utils::print_info "hledger-web started (PID ${_pid}). Point web browser to $_url"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user