Skip to content

Commit 709b62b

Browse files
committed
Only categories
1 parent 3fc5c0a commit 709b62b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

bin/recategorize-messages.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,13 @@ def yield_account_id_and_message_ids(
9090
@click.option("--only-account-id", type=int, default=None)
9191
@click.option("--only-inbox", is_flag=True, default=False)
9292
@click.option("--only-types", default=",".join(ALL_ACCOUNT_TYPES))
93+
@click.option("--only-categories", default=None)
9394
@click.option("--dry-run/--no-dry-run", default=True)
9495
def main(
9596
only_account_id: int | None,
9697
only_inbox: bool,
9798
only_types: str,
99+
only_categories: str | None,
98100
date_start: datetime.date | None,
99101
date_end: datetime.date | None,
100102
dry_run: bool,
@@ -137,6 +139,11 @@ def session_factory():
137139
category.name for category in message.categories if category.name
138140
)
139141
if old_categories != new_categories:
142+
if only_categories and not new_categories & only_categories.split(
143+
","
144+
):
145+
continue
146+
140147
changed_counter += 1
141148
print(
142149
f"\t{message.id=}, {message.message_id_header=}, {old_categories=} to {new_categories=}"

0 commit comments

Comments
 (0)