aboutsummaryrefslogtreecommitdiffstats
path: root/firefly_cli/commands/transaction.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-07-01 11:37:53 +0200
committerDanilo M. <danix@danix.xyz>2026-07-01 11:37:53 +0200
commit4588f4bf54ae6eefd7a75904d81ce2256afb805d (patch)
treedade60deaee537480b4f6101c4fd6571dc1a69a1 /firefly_cli/commands/transaction.py
parent238a4506cfeda388d097265b133004b63f130de6 (diff)
downloadfirefly-cli-4588f4bf54ae6eefd7a75904d81ce2256afb805d.tar.gz
firefly-cli-4588f4bf54ae6eefd7a75904d81ce2256afb805d.zip
feat: tx add echoes transfer direction to stderr (v0.3.5)v0.3.5
Transfers are easy to reverse silently (swapped --from/--to), showing up later as a 2x balance discrepancy (ISSUES.md #5). On a transfer, tx add now prints "transfer: <from> → <to>, <amount>" to stderr before writing, in both the real-write and --dry-run paths. stdout JSON and exit codes are unchanged, so the contract holds; PATCH bump. Withdrawals/deposits are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'firefly_cli/commands/transaction.py')
-rw-r--r--firefly_cli/commands/transaction.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/firefly_cli/commands/transaction.py b/firefly_cli/commands/transaction.py
index 8d858b6..df1ffc4 100644
--- a/firefly_cli/commands/transaction.py
+++ b/firefly_cli/commands/transaction.py
@@ -54,6 +54,13 @@ def cmd_add(args, ctx):
split["category_name"] = args.category
if args.tags:
split["tags"] = [t.strip() for t in args.tags.split(",") if t.strip()]
+ if ttype == "transfer":
+ # Transfer direction is easy to reverse silently (ISSUES.md #5); echo it
+ # to stderr so the user/agent can catch a swapped --from/--to. stdout
+ # JSON unchanged; shown for both real writes and --dry-run.
+ import sys
+ print(f'transfer: {src["name"]} → {dst["name"]}, {split["amount"]}',
+ file=sys.stderr)
if args.dry_run:
# Accounts already resolved above (missing name = hard error). Write nothing.
# dry-run wins over skip-dupes: caller wants a preview, not a write.