Remove manual tagging
A tag could come from two places: rules.toml, or the TUI's t key, which wrote manual_tag with COALESCE(manual_tag, rule_tag) deciding the winner. That split paid for itself in the first invariant of the codebase, in ClearOverrides and the c key, in the * marker on the tag column, and in the one exception to a disposable index -- a tag set by hand was the only thing in index.db that the statements could not reproduce. Now rules.toml decides every tag. The index is derived entirely from the statements plus that file, so deleting it and re-importing gets back exactly what was there, and retag has nothing to be careful of. Tagging a one-off means writing a narrow rule on screen 4, which previews what the glob catches before it is saved. A manual tag in an existing index is dropped along with the column the first time this build opens it, and those rows read as whatever the rules say, or as untagged. TestManualTagSurvivesRetag guarded the invariant that has just been removed; TestRetagRewritesEveryTag replaces it with the one that took its place, and keeps Retag itself covered. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+4
-4
@@ -27,7 +27,7 @@ const usage = `money - statement-driven personal finance tracker
|
||||
usage: money [--root DIR] <command> [flags]
|
||||
|
||||
commands:
|
||||
tui browse and tag transactions, build and prune rules (default)
|
||||
tui browse transactions, build and prune the rules that tag them (default)
|
||||
import extract transactions from every statement into the index
|
||||
retag re-apply rules.toml to everything already imported
|
||||
ls list transactions
|
||||
@@ -230,7 +230,7 @@ func cmdLs(root string, args []string) error {
|
||||
account := fs.String("account", "", "only this account slug")
|
||||
month := fs.String("month", "", "only this month (YYYY-MM)")
|
||||
search := fs.String("search", "", "only descriptions containing this text")
|
||||
untagged := fs.Bool("untagged", false, "only transactions with no effective tag")
|
||||
untagged := fs.Bool("untagged", false, "only transactions no rule tagged")
|
||||
limit := fs.Int("limit", 0, "maximum rows (0 = no limit)")
|
||||
wide := fs.Bool("wide", false, "also show type and reported balance")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
@@ -268,11 +268,11 @@ func cmdLs(root string, args []string) error {
|
||||
}
|
||||
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",
|
||||
t.Date, t.AccountSlug, t.FormatAmount(), t.Currency, balance,
|
||||
t.Tag(), t.Type, t.Description)
|
||||
t.RuleTag, t.Type, t.Description)
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\n",
|
||||
t.Date, t.AccountSlug, t.FormatAmount(), t.Currency, t.Tag(), t.Description)
|
||||
t.Date, t.AccountSlug, t.FormatAmount(), t.Currency, t.RuleTag, t.Description)
|
||||
}
|
||||
w.Flush()
|
||||
fmt.Printf("\n%d transactions\n", len(txns))
|
||||
|
||||
Reference in New Issue
Block a user