From 7077e06d3d506d6a2e176dd0fcf2db2cbec0120c Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Tue, 24 Sep 2024 22:37:06 -0700 Subject: [PATCH] client: docker-finance.d: subscript: rewrite - Refactors and sorts - Consolidates commands * Shortens hledger-{ui,vui,web} * Comment out most aliases by default - Updates to latest impl - Adds notes and examples --- .../container/shell/subscript.bash.in | 76 ++++++++++--------- 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/client/docker-finance.d/container/shell/subscript.bash.in b/client/docker-finance.d/container/shell/subscript.bash.in index 38247f9..5958678 100644 --- a/client/docker-finance.d/container/shell/subscript.bash.in +++ b/client/docker-finance.d/container/shell/subscript.bash.in @@ -25,48 +25,54 @@ [ -z "$DOCKER_FINANCE_CONTAINER_CMD" ] && echo "DOCKER_FINANCE_CONTAINER_CMD not set, check installation" >&2 -# CLI hledger -alias @DOCKER_FINANCE_SUBPROFILE@_hledger='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ hledger' +# See `help` for all available commands and usage +dfi_base_cmd='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@' -# Note: command ends in `\` and newline so you can add more arguments as needed -alias @DOCKER_FINANCE_SUBPROFILE@_bal='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ hledger bal \ +# +# 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='$dfi_base_cmd hledger bal \ assets liabilities \ ' -# Terminal UI -alias @DOCKER_FINANCE_SUBPROFILE@_ui='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ hledger-ui' -alias @DOCKER_FINANCE_SUBPROFILE@_hledger-ui='@DOCKER_FINANCE_SUBPROFILE@_ui' +## Example: the previous command but with a prepended parent profile "namespace" +#alias @DOCKER_FINANCE_PROFILE@_@DOCKER_FINANCE_SUBPROFILE@_bal='$dfi_base_cmd hledger bal \ +# assets liabilities \ +#' -# Terminal UI (visidata) -alias @DOCKER_FINANCE_SUBPROFILE@_vui='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ hledger-vui' -alias @DOCKER_FINANCE_SUBPROFILE@_hledger-vui='@DOCKER_FINANCE_SUBPROFILE@_vui' +## Example: fetch all prices for default (current) year +#alias @DOCKER_FINANCE_SUBPROFILE@_prices='$dfi_base_cmd fetch all=price' -# Web UI -alias @DOCKER_FINANCE_SUBPROFILE@_web='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ hledger-web \' -alias @DOCKER_FINANCE_SUBPROFILE@_hledger-web='@DOCKER_FINANCE_SUBPROFILE@_web' +## Example: print tagged income on all accounts in CSV tax format for default (current) year +#alias @DOCKER_FINANCE_SUBPROFILE@_income_tax='$dfi_base_cmd taxes all=account tag=income write=off' -# Fetches, imports, generates taxes and reports (using defaults) -alias @DOCKER_FINANCE_SUBPROFILE@_all='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ all' +## Example: write income statements and balance sheets, quarterly & monthly for default (current) year +#alias @DOCKER_FINANCE_SUBPROFILE@_qm_reports='$dfi_base_cmd reports type=is,bs interval=quarterly,monthly' -# Edit configuration files -alias @DOCKER_FINANCE_SUBPROFILE@_edit='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ edit' - -# Fetch using remote APIs -alias @DOCKER_FINANCE_SUBPROFILE@_fetch='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ fetch' - -# hledger-flow CSV import -alias @DOCKER_FINANCE_SUBPROFILE@_import='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ import' - -# Financial metadata viewer -alias @DOCKER_FINANCE_SUBPROFILE@_meta='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ meta' - -# Generate financial reports -alias @DOCKER_FINANCE_SUBPROFILE@_reports='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ reports' - -# ROOT.cern / Metadata analysis / C++ interpreter -alias @DOCKER_FINANCE_SUBPROFILE@_root='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ root' - -# Generate tax reports -alias @DOCKER_FINANCE_SUBPROFILE@_taxes='$DOCKER_FINANCE_CONTAINER_CMD @DOCKER_FINANCE_PROFILE@/@DOCKER_FINANCE_SUBPROFILE@ taxes' +## Examples: uncomment and customize, as needed +#alias @DOCKER_FINANCE_SUBPROFILE@_all='$dfi_base_cmd all' +#alias @DOCKER_FINANCE_SUBPROFILE@_edit='$dfi_base_cmd edit' +#alias @DOCKER_FINANCE_SUBPROFILE@_fetch='$dfi_base_cmd fetch' +#alias @DOCKER_FINANCE_SUBPROFILE@_hledger='$dfi_base_cmd hledger' +#alias @DOCKER_FINANCE_SUBPROFILE@_import='$dfi_base_cmd import' +#alias @DOCKER_FINANCE_SUBPROFILE@_meta='$dfi_base_cmd meta' +#alias @DOCKER_FINANCE_SUBPROFILE@_plugins='$dfi_base_cmd plugins' +#alias @DOCKER_FINANCE_SUBPROFILE@_reports='$dfi_base_cmd reports' +#alias @DOCKER_FINANCE_SUBPROFILE@_root='$dfi_base_cmd root' +#alias @DOCKER_FINANCE_SUBPROFILE@_taxes='$dfi_base_cmd taxes' +#alias @DOCKER_FINANCE_SUBPROFILE@_times='$dfi_base_cmd times' +#alias @DOCKER_FINANCE_SUBPROFILE@_ui='$dfi_base_cmd hledger-ui' +#alias @DOCKER_FINANCE_SUBPROFILE@_vui='$dfi_base_cmd hledger-vui' +#alias @DOCKER_FINANCE_SUBPROFILE@_web='$dfi_base_cmd hledger-web' # vim: syn=bash sw=2 sts=2 si ai et