forked from EvergreenCrypto/docker-finance
container: remove ledger in place of hledger
As said before; `lib_ledger` was meant to be a general abstraction to any underlying CLI ledger. But, between C++ `ledger` and Ledger Hardware Wallet, this abstraction has become too confusing and counterproductive. Since `hledger` will be the underlying implementation for the forseeable future, all doubt should now be removed.
This commit is contained in:
@@ -70,7 +70,7 @@ This plugin's arguments:
|
||||
|
||||
Showing total current BTC balance:
|
||||
|
||||
$(lib_finance::ledger bal assets liabilities cur:BTC | tail -n1)
|
||||
$(lib_finance::hledger bal assets liabilities cur:BTC | tail -n1)
|
||||
|
||||
"
|
||||
lib_utils::print_custom "$_example"
|
||||
|
||||
@@ -31,7 +31,7 @@ function docker-finance::completion()
|
||||
mapfile -t _profiles < <(pushd "${DOCKER_FINANCE_CONTAINER_FLOW}"/profiles &>/dev/null && ls -d */*)
|
||||
declare -r _profiles
|
||||
|
||||
local -r _commands=("all" "edit" "fetch" "hledger" "hledger-ui" "hledger-vui" "hledger-web" "import" "ledger" "ledger-ui" "ledger-vui" "ledger-web" "meta" "plugins" "reports" "root" "taxes" "times")
|
||||
local -r _commands=("all" "edit" "fetch" "hledger" "hledger-ui" "hledger-vui" "hledger-web" "import" "meta" "plugins" "reports" "root" "taxes" "times")
|
||||
|
||||
local _reply
|
||||
|
||||
@@ -66,7 +66,7 @@ function docker-finance::completion()
|
||||
import)
|
||||
mapfile -t _reply < <(compgen -W "help year${global_arg_delim_2}" -- "$_cur")
|
||||
;;
|
||||
hledger | ledger)
|
||||
hledger)
|
||||
#
|
||||
# Commands (as described in v1.40)
|
||||
#
|
||||
@@ -95,13 +95,13 @@ function docker-finance::completion()
|
||||
|
||||
mapfile -t _reply < <(compgen -W "${_hledger[*]}" -- "$_cur")
|
||||
;;
|
||||
hledger-ui | ledger-ui)
|
||||
hledger-ui)
|
||||
mapfile -t _reply < <(compgen -W "-h" -- "$_cur")
|
||||
;;
|
||||
hledger-vui | ledger-vui)
|
||||
hledger-vui)
|
||||
mapfile -t _reply < <(compgen -W "-h" -- "$_cur")
|
||||
;;
|
||||
hledger-web | ledger-web)
|
||||
hledger-web)
|
||||
mapfile -t _reply < <(compgen -W "-h" -- "$_cur")
|
||||
;;
|
||||
meta)
|
||||
|
||||
@@ -113,17 +113,17 @@ function main()
|
||||
import)
|
||||
lib_finance::import "${@:3}"
|
||||
;;
|
||||
hledger | ledger)
|
||||
lib_finance::ledger "${@:3}"
|
||||
hledger)
|
||||
lib_finance::hledger "${@:3}"
|
||||
;;
|
||||
hledger-ui | ledger-ui)
|
||||
lib_finance::ledger-ui "${@:3}"
|
||||
hledger-ui)
|
||||
lib_finance::hledger-ui "${@:3}"
|
||||
;;
|
||||
hledger-vui | ledger-vui)
|
||||
lib_finance::ledger-vui "${@:3}"
|
||||
hledger-vui)
|
||||
lib_finance::hledger-vui "${@:3}"
|
||||
;;
|
||||
hledger-web | ledger-web)
|
||||
lib_finance::ledger-web "${@:3}"
|
||||
hledger-web)
|
||||
lib_finance::hledger-web "${@:3}"
|
||||
;;
|
||||
meta)
|
||||
lib_finance::meta "${@:3}"
|
||||
|
||||
@@ -28,38 +28,38 @@ source "${DOCKER_FINANCE_CONTAINER_REPO}/src/finance/lib/internal/lib_utils.bash
|
||||
# Facade
|
||||
#
|
||||
|
||||
function lib_ledger::ledger-import()
|
||||
function lib_hledger::hledger-import()
|
||||
{
|
||||
lib_ledger::__ledger "$@"
|
||||
lib_ledger::__ledger-import "$@"
|
||||
lib_hledger::__hledger "$@"
|
||||
lib_hledger::__hledger-import "$@"
|
||||
lib_utils::catch $?
|
||||
}
|
||||
|
||||
function lib_ledger::ledger-cli()
|
||||
function lib_hledger::hledger-cli()
|
||||
{
|
||||
lib_ledger::__ledger "$@"
|
||||
lib_ledger::__ledger-cli "$@"
|
||||
lib_hledger::__hledger "$@"
|
||||
lib_hledger::__hledger-cli "$@"
|
||||
lib_utils::catch $?
|
||||
}
|
||||
|
||||
function lib_ledger::ledger-ui()
|
||||
function lib_hledger::hledger-ui()
|
||||
{
|
||||
lib_ledger::__ledger "$@"
|
||||
lib_ledger::__ledger-ui "$@"
|
||||
lib_hledger::__hledger "$@"
|
||||
lib_hledger::__hledger-ui "$@"
|
||||
lib_utils::catch $?
|
||||
}
|
||||
|
||||
function lib_ledger::ledger-vui()
|
||||
function lib_hledger::hledger-vui()
|
||||
{
|
||||
lib_ledger::__ledger "$@"
|
||||
lib_ledger::__ledger-vui "$@"
|
||||
lib_hledger::__hledger "$@"
|
||||
lib_hledger::__hledger-vui "$@"
|
||||
lib_utils::catch $?
|
||||
}
|
||||
|
||||
function lib_ledger::ledger-web()
|
||||
function lib_hledger::hledger-web()
|
||||
{
|
||||
lib_ledger::__ledger "$@"
|
||||
lib_ledger::__ledger-web "$@"
|
||||
lib_hledger::__hledger "$@"
|
||||
lib_hledger::__hledger-web "$@"
|
||||
lib_utils::catch $?
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ function lib_ledger::ledger-web()
|
||||
#
|
||||
|
||||
# Constructor
|
||||
function lib_ledger::__ledger()
|
||||
function lib_hledger::__hledger()
|
||||
{
|
||||
# Base arguments to hledger before end-user added
|
||||
[ -z "$global_child_profile_journal" ] && lib_utils::die_fatal
|
||||
@@ -97,7 +97,7 @@ function lib_ledger::__ledger()
|
||||
lib_utils::print_debug "${global_base_args[*]}" "$@"
|
||||
}
|
||||
|
||||
function lib_ledger::__parse_ledger-import()
|
||||
function lib_hledger::__parse_hledger-import()
|
||||
{
|
||||
[ -z "$global_usage" ] && lib_utils::die_fatal
|
||||
[ -z "$global_arg_delim_1" ] && lib_utils::die_fatal
|
||||
@@ -157,30 +157,30 @@ function lib_ledger::__parse_ledger-import()
|
||||
fi
|
||||
}
|
||||
|
||||
function lib_ledger::__ledger-import()
|
||||
function lib_hledger::__hledger-import()
|
||||
{
|
||||
lib_ledger::__parse_ledger-import "$@"
|
||||
lib_hledger::__parse_hledger-import "$@"
|
||||
|
||||
time hledger-flow import \
|
||||
"$(dirname $global_child_profile_journal)" \
|
||||
--start-year "$global_arg_year"
|
||||
}
|
||||
|
||||
function lib_ledger::__ledger-cli()
|
||||
function lib_hledger::__hledger-cli()
|
||||
{
|
||||
[ -z "${global_base_args[*]}" ] && lib_utils::die_fatal
|
||||
|
||||
hledger "${global_base_args[@]}" "$@"
|
||||
}
|
||||
|
||||
function lib_ledger::__ledger-ui()
|
||||
function lib_hledger::__hledger-ui()
|
||||
{
|
||||
[ -z "${global_base_args[*]}" ] && lib_utils::die_fatal
|
||||
|
||||
hledger-ui "${global_base_args[@]}" "$@"
|
||||
}
|
||||
|
||||
function lib_ledger::__ledger-vui()
|
||||
function lib_hledger::__hledger-vui()
|
||||
{
|
||||
[ -z "${global_base_args[*]}" ] && lib_utils::die_fatal
|
||||
|
||||
@@ -188,7 +188,7 @@ function lib_ledger::__ledger-vui()
|
||||
| visidata --motd-url file:///dev/null --filetype csv
|
||||
}
|
||||
|
||||
function lib_ledger::__ledger-web()
|
||||
function lib_hledger::__hledger-web()
|
||||
{
|
||||
[ -z "${global_base_args[*]}" ] && lib_utils::die_fatal
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ function lib_finance::finance()
|
||||
# Implementation "libraries" (requires previously set globals)
|
||||
source "${DOCKER_FINANCE_CONTAINER_REPO}/src/finance/lib/internal/lib_edit.bash" || exit 1
|
||||
source "${DOCKER_FINANCE_CONTAINER_REPO}/src/finance/lib/internal/lib_fetch.bash" || exit 1
|
||||
source "${DOCKER_FINANCE_CONTAINER_REPO}/src/finance/lib/internal/lib_ledger.bash" || exit 1
|
||||
source "${DOCKER_FINANCE_CONTAINER_REPO}/src/finance/lib/internal/lib_hledger.bash" || exit 1
|
||||
source "${DOCKER_FINANCE_CONTAINER_REPO}/src/finance/lib/internal/lib_meta.bash" || exit 1
|
||||
source "${DOCKER_FINANCE_CONTAINER_REPO}/src/finance/lib/internal/lib_plugins.bash" || exit 1
|
||||
source "${DOCKER_FINANCE_CONTAINER_REPO}/src/finance/lib/internal/lib_reports.bash" || exit 1
|
||||
@@ -173,31 +173,31 @@ function lib_finance::fetch()
|
||||
|
||||
function lib_finance::import()
|
||||
{
|
||||
lib_ledger::ledger-import "$@"
|
||||
lib_hledger::hledger-import "$@"
|
||||
lib_utils::catch $?
|
||||
}
|
||||
|
||||
function lib_finance::ledger()
|
||||
function lib_finance::hledger()
|
||||
{
|
||||
lib_ledger::ledger-cli "$@"
|
||||
lib_hledger::hledger-cli "$@"
|
||||
lib_utils::catch $?
|
||||
}
|
||||
|
||||
function lib_finance::ledger-ui()
|
||||
function lib_finance::hledger-ui()
|
||||
{
|
||||
lib_ledger::ledger-ui "$@"
|
||||
lib_hledger::hledger-ui "$@"
|
||||
lib_utils::catch $?
|
||||
}
|
||||
|
||||
function lib_finance::ledger-vui()
|
||||
function lib_finance::hledger-vui()
|
||||
{
|
||||
lib_ledger::ledger-vui "$@"
|
||||
lib_hledger::hledger-vui "$@"
|
||||
lib_utils::catch $?
|
||||
}
|
||||
|
||||
function lib_finance::ledger-web()
|
||||
function lib_finance::hledger-web()
|
||||
{
|
||||
lib_ledger::ledger-web "$@"
|
||||
lib_hledger::hledger-web "$@"
|
||||
lib_utils::catch $?
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user