Add a rule builder screen with a live glob preview
Writing a glob by hand meant guessing what it would catch, then running retag to find out. The new screen, on 4, puts the glob, account and tag fields on the left and every still-untagged description on the right, sorted alphabetically and grouped by description with an occurrence count. Matches are marked as the glob is typed, along with a count, so the effect of a rule is visible before it is written. Enter appends it to rules.toml via config.AppendRule, reloads the engine from disk and retags, so the rows it caught leave the list immediately. Rules are appended rather than prepended, keeping the precedence of anything already in the file. Since the preview only lists transactions no existing rule has tagged, it reflects that precedence for free. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -69,7 +69,7 @@ imported — creating an `account.toml` is not enough on its own. Run
|
||||
|
||||
| Key | Action |
|
||||
| --- | --- |
|
||||
| `1` `2` `3` / `tab` | accounts · transactions · report |
|
||||
| `1` `2` `3` `4` / `tab` | accounts · transactions · report · rule builder |
|
||||
| `enter` | open the selected account (accounts view) |
|
||||
| `t` | set the tag on the selected transaction |
|
||||
| `x` | toggle transfer on the selected transaction |
|
||||
@@ -79,6 +79,33 @@ imported — creating an `account.toml` is not enough on its own. Run
|
||||
| `a` | clear the account filter |
|
||||
| `i` | import · `r` re-apply rules · `q` quit |
|
||||
|
||||
### Rule builder (`4`)
|
||||
|
||||
Writing rules by hand means guessing what a glob will catch. This screen shows
|
||||
the answer as you type: the form is on the left, and on the right is every
|
||||
still-untagged description in the data, sorted alphabetically and grouped, with
|
||||
a `▸` against each one the glob currently matches and a running
|
||||
"*n* of *m* descriptions match" count.
|
||||
|
||||
```
|
||||
▸ glob Untagged description N
|
||||
╭────────────────────────────╮ ACME PAYROLL JAN 1
|
||||
│ *LIDL* │ BOLT RIDE 1
|
||||
╰────────────────────────────╯ ▸ LIDL SOFIA 4412 2
|
||||
vs. the description ▸ LIDL VARNA 9911 1
|
||||
ZARA MLADOST 1
|
||||
2 of 7 descriptions match
|
||||
```
|
||||
|
||||
`tab` / `↑↓` move between the glob, account and tag fields, `pgup` / `pgdn`
|
||||
scroll the list, and `enter` appends the rule to `rules.toml` and retags
|
||||
immediately, so the rows it caught disappear from the list. `esc` goes back.
|
||||
|
||||
Leaving the account blank applies the rule everywhere; filling it in also
|
||||
narrows the preview to that account. Rules are appended, so anything already in
|
||||
`rules.toml` keeps precedence — the preview accounts for that automatically,
|
||||
since it only ever lists transactions no existing rule has already tagged.
|
||||
|
||||
## rules.toml
|
||||
|
||||
Rules are evaluated in file order and the **first match wins**, so put transfer
|
||||
|
||||
Reference in New Issue
Block a user