summaryrefslogtreecommitdiffstats
path: root/firefly_cli/commands/transaction.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-07-01 10:18:39 +0200
committerDanilo M. <danix@danix.xyz>2026-07-01 10:18:39 +0200
commit0c9939c5961a3cef50e6378c0eefbeaae00f4c67 (patch)
treeca75f91cf69cf085621fd22241d4081bb118edaf /firefly_cli/commands/transaction.py
parent38d7357f36e6eeb91216d1c5668fb29406c7e076 (diff)
downloadfirefly-cli-0c9939c5961a3cef50e6378c0eefbeaae00f4c67.tar.gz
firefly-cli-0c9939c5961a3cef50e6378c0eefbeaae00f4c67.zip
feat: tx list --all + truncation signal (v0.3.1)
tx list silently returned only --limit rows (default 20) with no signal when more matched, making a correct ledger look wrong during reconciliation. - --all auto-paginates every page via meta.pagination.total_pages - without --all, print "showing N of M (use --all for all)" to stderr when the result is truncated (stdout JSON stays clean) PATCH: new optional flag + stderr note, contract unchanged. 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.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/firefly_cli/commands/transaction.py b/firefly_cli/commands/transaction.py
index af8a4fb..1d6f219 100644
--- a/firefly_cli/commands/transaction.py
+++ b/firefly_cli/commands/transaction.py
@@ -110,6 +110,8 @@ def _list_args(p):
p.add_argument("--until", default=None, help="end date YYYY-MM-DD")
p.add_argument("--account", default=None, help="filter by account name")
p.add_argument("--limit", type=int, default=20)
+ p.add_argument("--all", action="store_true",
+ help="fetch every page (ignores --limit truncation)")
@registry.command("tx list", help="list recent transactions (newest first)", args=_list_args)
def cmd_list(args, ctx):
@@ -123,7 +125,25 @@ def cmd_list(args, ctx):
params["start"] = args.since
if args.until:
params["end"] = args.until
+
+ if args.all:
+ rows, page = [], 1
+ while True:
+ resp = ctx.client.request("GET", path, params={**params, "page": page})
+ rows.extend(output.unwrap(resp))
+ pg = (resp.get("meta") or {}).get("pagination") or {}
+ if page >= (pg.get("total_pages") or 1):
+ break
+ page += 1
+ output.emit(rows, human=ctx.human)
+ return 0
+
resp = ctx.client.request("GET", path, params=params)
+ pg = (resp.get("meta") or {}).get("pagination") or {}
+ total, count = pg.get("total"), pg.get("count")
+ if total is not None and count is not None and count < total:
+ import sys
+ print(f"showing {count} of {total} (use --all for all)", file=sys.stderr)
output.emit(output.unwrap(resp), human=ctx.human)
return 0