aboutsummaryrefslogtreecommitdiffstats
path: root/firefly_cli
diff options
context:
space:
mode:
Diffstat (limited to 'firefly_cli')
-rw-r--r--firefly_cli/commands/transaction.py5
1 files changed, 5 insertions, 0 deletions
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