Mortgage Calculator
Multi-purpose utility tool for managing structured data entries related to mortgage and financial calculations. Add, list, search, remove, and export data items — all stored locally in a simple log-based format with full history tracking.
Commands
All commands are invoked via mortgage-calculator <command> [args].
| Command | Description |
|---|
| INLINECODE1 | Execute the main function — logs and confirms execution of the specified operation |
| INLINECODE2 |
Show the configuration file path (
$DATA_DIR/config.json) |
|
status | Show current status (reports "ready" when the tool is operational) |
|
init | Initialize the data directory (creates the data folder if it doesn't exist) |
|
list | List all data entries from the data log file |
|
add <text> | Add a new dated entry to the data log (auto-prefixed with
YYYY-MM-DD) |
|
remove <item> | Remove an entry and log the removal |
|
search <term> | Search the data log for a keyword (case-insensitive match via
grep -i) |
|
export | Export all data from the data log to stdout |
|
info | Show current version number and data directory path |
|
help | Show the built-in help message with all available commands |
|
version | Print version string (
mortgage-calculator v2.0.0) |
Data Storage
- - Location:
~/.local/share/mortgage-calculator/ (override with MORTGAGE_CALCULATOR_DIR environment variable, or XDG_DATA_HOME) - Data log:
data.log — stores all entries added via add, one per line, prefixed with INLINECODE22 - History:
history.log — every command execution is recorded with a timestamp (MM-DD HH:MM command: details) for auditing - Format: Plain text, one entry per line, human-readable
Requirements
- - Bash 4+
- Standard Unix utilities (
date, grep, cat, echo) - No external dependencies, no API keys, no network access needed
When to Use
- 1. Financial record keeping — Use
mortgage-calculator add to log mortgage-related events (payments made, rate changes, lender communications) and build a local history - Payment tracking — Record monthly payments, extra payments, or escrow changes with
add, then review the full log with INLINECODE31 - Comparison notes — Store notes from different loan scenarios or lender quotes using
add, then search to find specific terms or rates - Data export for spreadsheets — Use
mortgage-calculator export to dump all entries to stdout and redirect to a file for import into Excel or Google Sheets - Automation and scripting — Integrate
mortgage-calculator add and mortgage-calculator export into shell scripts or cron jobs for automated financial logging workflows
Examples
CODEBLOCK0
Output
All command output goes to stdout. Redirect to save:
CODEBLOCK1
Configuration
Set the MORTGAGE_CALCULATOR_DIR environment variable to change the data directory:
CODEBLOCK2
Default location: ~/.local/share/mortgage-calculator/
Powered by BytesAgain | bytesagain.com | hello@bytesagain.com
技能名称:抵押贷款计算器
详细描述:
抵押贷款计算器
用于管理与抵押贷款和财务计算相关的结构化数据条目的多用途工具。支持添加、列出、搜索、删除和导出数据项——所有数据均以简单的基于日志的格式本地存储,并带有完整的历史记录追踪。
命令
所有命令通过 mortgage-calculator [args] 调用。
| 命令 | 描述 |
|---|
| run <args> | 执行主要功能——记录并确认指定操作的执行 |
| config |
显示配置文件路径($DATA_DIR/config.json) |
| status | 显示当前状态(工具可运行时报告就绪) |
| init | 初始化数据目录(如果数据文件夹不存在则创建) |
| list | 列出数据日志文件中的所有数据条目 |
| add | 向数据日志添加新的带日期条目(自动添加YYYY-MM-DD前缀) |
| remove - | 删除条目并记录删除操作 |
| search | 在数据日志中搜索关键词(通过grep -i进行不区分大小写的匹配) |
| export | 将数据日志中的所有数据导出到标准输出 |
| info | 显示当前版本号和数据目录路径 |
| help | 显示包含所有可用命令的内置帮助信息 |
| version | 打印版本字符串(mortgage-calculator v2.0.0) |
数据存储
- - 位置: ~/.local/share/mortgage-calculator/(可通过MORTGAGECALCULATORDIR环境变量或XDGDATAHOME覆盖)
- 数据日志: data.log——存储通过add添加的所有条目,每行一条,带有YYYY-MM-DD前缀
- 历史记录: history.log——每次命令执行都会记录时间戳(MM-DD HH:MM command: details)以供审计
- 格式: 纯文本,每行一条条目,人类可读
要求
- - Bash 4+
- 标准Unix工具(date、grep、cat、echo)
- 无外部依赖,无需API密钥,无需网络访问
使用场景
- 1. 财务记录保存——使用mortgage-calculator add记录抵押贷款相关事件(已付款项、利率变动、贷款机构沟通),建立本地历史记录
- 付款追踪——使用add记录每月付款、额外付款或托管账户变更,然后通过list查看完整日志
- 比较笔记——使用add存储不同贷款方案或贷款机构报价的笔记,然后通过search查找特定条款或利率
- 数据导出到电子表格——使用mortgage-calculator export将所有条目输出到标准输出,并重定向到文件以便导入Excel或Google Sheets
- 自动化与脚本编写——将mortgage-calculator add和mortgage-calculator export集成到Shell脚本或cron作业中,实现自动化财务记录工作流
示例
bash
初始化数据目录
mortgage-calculator init
添加抵押贷款付款记录
mortgage-calculator add 月供:¥4,235.00 — 本金¥2,100 + 利息¥2,135
添加利率变动备注
mortgage-calculator add 利率从3.85%调整为3.50%,自2025-01-01生效
添加提前还款记录
mortgage-calculator add 提前还款:¥50,000用于本金,新余额¥680,000
列出所有条目
mortgage-calculator list
搜索关于利率变动的条目
mortgage-calculator search 利率
搜索提前还款记录
mortgage-calculator search 提前还款
将所有数据导出到文件
mortgage-calculator export > mortgage-history.txt
检查当前状态
mortgage-calculator status
显示版本和数据路径
mortgage-calculator info
运行自定义操作
mortgage-calculator run 季度审查
输出
所有命令输出到标准输出。重定向以保存:
bash
mortgage-calculator list > all-records.txt
mortgage-calculator export > backup.txt
配置
设置MORTGAGECALCULATORDIR环境变量以更改数据目录:
bash
export MORTGAGECALCULATORDIR=$HOME/my-mortgage-data
mortgage-calculator init
默认位置:~/.local/share/mortgage-calculator/
由BytesAgain提供 | bytesagain.com | hello@bytesagain.com