forked from EvergreenCrypto/docker-finance
docker-finance | modern accounting for the power-user
Dedicated to Michael Morgan: a beautiful, beautiful soul.
---
Internal signing keys:
Aaron Fiore (sole author)
- 518A22F85BEFD32BCC99C48603F90C4F35E0213E
- 31ECA5C347A0CC0815EDE730A3EACCFCDA7E685E
- C8187C585CB07A4DA81CC0F37318B50EBE9C0DA8
Internal repositories (rebased from):
Staging:
$ git log -n1 --pretty=format:"%H"
c8e0cd66f6c89fa7b3c62f72fb524a4cc454b7b6
$ git rev-list --max-parents=0 HEAD
ac3863b8c234755855f1aea3a07a853122decdf2
Private:
$ git log -n1 --pretty=format:"%H"
69bb3591eaa2990a9637832bb484690e00c4f926
$ git rev-list --max-parents=0 HEAD
a5c1cc9fb593c4cf09bc0adfef6cb6d2964511ae
This commit is contained in:
139
container/src/finance/finance.bash
Executable file
139
container/src/finance/finance.bash
Executable file
@@ -0,0 +1,139 @@
|
||||
#!/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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
#
|
||||
# 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 <profile>${global_arg_delim_1}<subprofile> <command> [args]
|
||||
|
||||
\e[32mProfile:\e[0m
|
||||
|
||||
<profile> \e[34;3mParent (category) profile (e.g., personal or business)\e[0m
|
||||
<subprofile> \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 ledger-based commands\e[0m
|
||||
ledger-ui \e[34;3mStart ncurses-based UI\e[0m
|
||||
ledger-web \e[34;3mStart web-based UI\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)
|
||||
lib_finance::ledger "${@:3}"
|
||||
;;
|
||||
ledger-ui)
|
||||
lib_finance::ledger-ui "${@:3}"
|
||||
;;
|
||||
ledger-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
|
||||
Reference in New Issue
Block a user