diff --git a/container/plugins/finance/example.bash b/container/plugins/finance/example.bash index b0d55b2..66f1ac3 100755 --- a/container/plugins/finance/example.bash +++ b/container/plugins/finance/example.bash @@ -38,9 +38,12 @@ [ -z "$DOCKER_FINANCE_CONTAINER_REPO" ] && exit 1 source "${DOCKER_FINANCE_CONTAINER_REPO}/src/finance/lib/lib_finance.bash" +[[ -z "$global_parent_profile" || -z "$global_arg_delim_1" || -z "$global_child_profile" ]] && lib_utils::die_fatal +instance="${global_parent_profile}${global_arg_delim_1}${global_child_profile}" + # Initialize "constructor" -[[ -z "$global_parent_profile" || -z "$global_arg_delim_1" || -z "$global_child_profile" ]] && exit 1 -lib_finance::finance "${global_parent_profile}${global_arg_delim_1}${global_child_profile}" +# NOTE: "constructor" only needed if calling library directly +lib_finance::finance "$instance" || lib_utils::die_fatal # # Implementation @@ -48,14 +51,14 @@ lib_finance::finance "${global_parent_profile}${global_arg_delim_1}${global_chil function main() { - echo -e " + local -r _example=" This container's environment: $(printenv | grep ^DOCKER_FINANCE | sort) This plugin's caller profile: - ${global_parent_profile}${global_arg_delim_1}${global_child_profile} + $instance This plugin's path is: @@ -66,10 +69,11 @@ This plugin's arguments: '${*}' Showing total current BTC balance: + + $(lib_finance::ledger bal assets liabilities cur:BTC | tail -n1) + " - echo -n " " - lib_finance::ledger bal assets liabilities cur:BTC | tail -n1 - echo + lib_utils::print_custom "$_example" } main "$@"