#!/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 . # # Implementation # [ -z "$DOCKER_FINANCE_CONTAINER_REPO" ] && exit 1 source "${DOCKER_FINANCE_CONTAINER_REPO}/src/finance/lib/lib_finance.bash" || exit 1 # # Execute # function main() { [ -z "$global_basename" ] && lib_utils::die_fatal [ -z "$global_arg_delim_1" ] && lib_utils::die_fatal [ -z "$global_arg_delim_2" ] && lib_utils::die_fatal local _usage=" \e[32mDescription:\e[0m The 'finance' in 'docker-finance' \e[32mUsage:\e[0m $ $global_basename ${global_arg_delim_1} [args] \e[32mProfile:\e[0m \e[34;3mParent (category) profile (e.g., personal or business)\e[0m \e[34;3mChild (username) profile (e.g., alice or evergreencrypto)\e[0m \e[32mCommand:\e[0m all \e[34;3mFetches, imports, generates taxes and reports w/ [args] year\e[0m edit \e[34;3mEdit existing container data\e[0m fetch \e[34;3mFetch remote accounts\e[0m import \e[34;3mImport CSVs for given year (default: current year)\e[0m ledger \e[34;3mRun CLI accounting commands (hledger)\e[0m ledger-ui \e[34;3mStart terminal UI (hledger-ui)\e[0m ledger-web \e[34;3mStart web-based UI (hledger-web)\e[0m meta \e[34;3mSearch local financial metadata\e[0m reports \e[34;3mGenerate balance sheet, income statement, etc.\e[0m root \e[34;3mRun ROOT.cern instance for docker-finance analysis\e[0m taxes \e[34;3mGenerate tax reports\e[0m \e[32mOptional:\e[0m [args] \e[34;3mOptional arguments to command (when applicable)\e[0m \e[32mExamples:\e[0m \e[37;2m# See help usage for the 'edit' command (e.g., to edit 'fetch' configuration)\e[0m $ $global_basename household${global_arg_delim_1}spouse edit help \e[37;2m# Fetch all of Alice's prices (as seen in her 'fetch' configuration)\e[0m $ $global_basename family${global_arg_delim_1}alice fetch all${global_arg_delim_2}price \e[37;2m# Import all of Bob's accounts for the years 2022 to now\e[0m $ $global_basename family${global_arg_delim_1}bob import year${global_arg_delim_2}2022 \e[37;2m# Show Carol's total USD value of Bitcoin across all asset accounts\e[0m $ $global_basename friends${global_arg_delim_1}carol ledger bal assets cur:BTC --value=now \e[37;2m# Generate quarterly reports for your vendor 'ABC Inc.' in the year 2023\e[0m $ $global_basename vendors${global_arg_delim_1}abc_inc reports all${global_arg_delim_2}type interval=quarterly year=2023 " # # "Constructor" (initializes finance environment) # lib_finance::finance "$@" || lib_utils::die_usage "$_usage" # # Facade commands # case "$2" in all) lib_finance::all "${@:3}" ;; edit) lib_finance::edit "${@:3}" ;; fetch) lib_finance::fetch "${@:3}" ;; import) lib_finance::import "${@:3}" ;; ledger | hledger) lib_finance::ledger "${@:3}" ;; ledger-ui | hledger-ui) lib_finance::ledger-ui "${@:3}" ;; ledger-web | hledger-web) lib_finance::ledger-web "${@:3}" ;; meta) lib_finance::meta "${@:3}" ;; reports) lib_finance::reports "${@:3}" ;; root) lib_finance::root "${@:3}" ;; taxes) lib_finance::taxes "${@:3}" ;; *) lib_utils::die_usage "$_usage" ;; esac } main "$@" # vim: sw=2 sts=2 si ai et