Files
docker-finance/client/docker-finance.d/container/shell/subscript.bash.in
Aaron Fiore 750265d4b6 client: docker-finance.d: subscript: remove base cmd
The recently added base command variable would break on multi-profile
systems because, when superscript first sources, this global variable
would be set.

Unsetting/resetting the variable will not be a fix so, revert to the
noisy but dynamic per-alias-generated solution instead.
2024-09-30 16:24:01 -07:00

76 lines
4.4 KiB
Bash

#!/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/>.
# docker-finance @DOCKER_FINANCE_VERSION@
#
# Subscript (subprofile script) called by superscript
#
[ -z "$DOCKER_FINANCE_CONTAINER_CMD" ] && echo "DOCKER_FINANCE_CONTAINER_CMD not set, check installation" >&2
#
# Notes:
#
# - This file is most useful for single-user or multiple
# non-conflicting subprofile names.
#
# * To avoid naming conflicts, see the example below to create a
# parent prepended profile "namespace".
#
# - See `edit type=hledger` for customizable hledger options that
# you'd otherwise apply to all of the subprofile's hledger commands.
#
alias @DOCKER_FINANCE_SUBPROFILE@_bal='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ hledger bal \
assets liabilities \
'
## Example: the previous command but with a prepended parent profile "namespace"
#alias @DOCKER_FINANCE_PROFILE@_@DOCKER_FINANCE_SUBPROFILE@_bal='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ hledger bal \
# assets liabilities \
#'
## Example: fetch all prices for default (current) year
#alias @DOCKER_FINANCE_SUBPROFILE@_prices='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ fetch all=price'
## Example: print tagged income on all accounts in CSV tax format for default (current) year
#alias @DOCKER_FINANCE_SUBPROFILE@_income_tax='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ taxes all=account tag=income write=off'
## Example: write income statements and balance sheets, quarterly & monthly for default (current) year
#alias @DOCKER_FINANCE_SUBPROFILE@_qm_reports='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ reports type=is,bs interval=quarterly,monthly'
## Examples: uncomment and customize, as needed
#alias @DOCKER_FINANCE_SUBPROFILE@_all='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ all'
#alias @DOCKER_FINANCE_SUBPROFILE@_edit='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ edit'
#alias @DOCKER_FINANCE_SUBPROFILE@_fetch='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ fetch'
#alias @DOCKER_FINANCE_SUBPROFILE@_hledger='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ hledger'
#alias @DOCKER_FINANCE_SUBPROFILE@_import='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ import'
#alias @DOCKER_FINANCE_SUBPROFILE@_meta='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ meta'
#alias @DOCKER_FINANCE_SUBPROFILE@_plugins='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ plugins'
#alias @DOCKER_FINANCE_SUBPROFILE@_reports='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ reports'
#alias @DOCKER_FINANCE_SUBPROFILE@_root='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ root'
#alias @DOCKER_FINANCE_SUBPROFILE@_taxes='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ taxes'
#alias @DOCKER_FINANCE_SUBPROFILE@_times='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ times'
#alias @DOCKER_FINANCE_SUBPROFILE@_ui='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ hledger-ui'
#alias @DOCKER_FINANCE_SUBPROFILE@_vui='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ hledger-vui'
#alias @DOCKER_FINANCE_SUBPROFILE@_web='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ hledger-web'
# vim: syn=bash sw=2 sts=2 si ai et