From 34ede2c7d38849282e46298538a14a7162cc9a37 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 3 Jul 2026 17:58:00 +0200 Subject: feat(tx): tx add --budget assigns a budget by name or id Co-Authored-By: Claude Opus 4.8 --- firefly_cli/commands/transaction.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'firefly_cli/commands') diff --git a/firefly_cli/commands/transaction.py b/firefly_cli/commands/transaction.py index 60af6f4..9f8e130 100644 --- a/firefly_cli/commands/transaction.py +++ b/firefly_cli/commands/transaction.py @@ -32,6 +32,8 @@ def _add_args(p): p.add_argument("--date", default=None, help="YYYY-MM-DD (default today)") p.add_argument("--category", default=None) p.add_argument("--tags", default=None, help="comma-separated") + p.add_argument("--budget", default=None, + help="budget name or id to assign (must already exist)") p.add_argument("--type", default=None, help="withdrawal|deposit|transfer (overrides inference)") p.add_argument("--dry-run", dest="dry_run", action="store_true", @@ -67,6 +69,9 @@ 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 args.budget: + # Budgets must pre-exist; resolve name/id -> id (hard error on miss). + split["budget_id"] = ctx.resolver.budget(args.budget)["id"] 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 -- cgit v1.2.3