diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-02 09:10:46 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-02 09:10:46 +0200 |
| commit | 166f82d0bfdc598099c088275d68dc42499694f9 (patch) | |
| tree | 4a4220fc737a8a5e38c15380a5c879a891dbf923 /firefly_cli/resolver.py | |
| parent | 1802450e437de9d31b9044089c162993866f023d (diff) | |
| download | firefly-cli-ec21cc694737b2b21062ca202e77f9eb6c1f66ed.tar.gz firefly-cli-ec21cc694737b2b21062ca202e77f9eb6c1f66ed.zip | |
feat: tx add --from-id/--to-id to disambiguate same-name accounts (v0.3.7)v0.3.7
ISSUES.md #2: two accounts can share a name (e.g. expense id 52 and
revenue id 129 both "Nexi"), making --from/--to ambiguous and
unresolvable. Add --from-id/--to-id to target an account by numeric id.
Per side, exactly one of the name flag or the id flag; sides
independent. The id path fetches the account (resolver.account_by_id),
validating existence before writing. Name-only callers unchanged;
JSON/exit unchanged, so PATCH.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'firefly_cli/resolver.py')
| -rw-r--r-- | firefly_cli/resolver.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/firefly_cli/resolver.py b/firefly_cli/resolver.py index 7673af6..2a73e79 100644 --- a/firefly_cli/resolver.py +++ b/firefly_cli/resolver.py @@ -28,6 +28,12 @@ class Resolver: def account(self, name): return self._match("account", self._list("/api/v1/accounts"), name) + def account_by_id(self, acc_id): + # Escape hatch for same-name accounts (ISSUES.md #2): GET the account + # directly; a bad id 404s and client.request surfaces a FireflyError. + item = self.client.request("GET", f"/api/v1/accounts/{acc_id}")["data"] + return {"id": item["id"], **item.get("attributes", {})} + def tag(self, name): return self._match("tag", self._list("/api/v1/tags"), name) |
