| Crates.io | notmuch-tagrewriter |
| lib.rs | notmuch-tagrewriter |
| version | 0.1.0 |
| created_at | 2025-07-02 22:18:11.719729+00 |
| updated_at | 2025-07-02 22:18:11.719729+00 |
| description | Retag notmuch mails |
| homepage | https://codeberg.org/xaltsc/notmuch-tagrewriter |
| repository | https://codeberg.org/xaltsc/notmuch-tagrewriter |
| max_upload_size | |
| id | 1735651 |
| size | 138,986 |
notmuch-tagrewriter is a small program that handles automatic tagging of
notmuch messages. The main focus of this
program is to provide an idempotent behaviour: the final state is reached in a single execution
and successive runs don't produce different database states.
Define rules in the config file (default path is
$XDG_CONFIG_DIR/notmuch-tagrewriter/config.yaml, then run
notmuch-tagrewriter tag.
Usage: notmuch-tagrewriter [OPTIONS] [COMMAND]
Commands:
graph Print a graphviz dot representation of the rewriting rules
cycles Find cycles in the set of rules
tag Rewrite tags
help Print this message or the help of the given subcommand(s)
Options:
-c, --config <FILE> Set config file
-h, --help Print help
config.yaml# whether to track last commit and only run on messages changed since last commit. False if omitted
track_lastmod: false
# defaults to notmuch default if omitted
notmuch_config: /path/to/notmuch/config
rules:
# queries are standard notmuch queries, but only tag predicates
# are allowed
- query: tag:a and tag:b or (not tag:c)
rewrite: +c -a
name: add c tag and remove a
- query:
# query can also be a list, in which case this is interpreted as
# query1 OR query2 OR ...
- tag:a and tag:b
- not tag:c
rewrite: +d
name: list rule
By design, notmuch-tagrewriter can only query for tags and act on
them. This is a limitation of the underlying model used to ensure
idempotence and why this tool just rewrites tags. In order to act on
tags, you still have to set them using broader queries in your
post-new hook.
notmuch-tagrewriter was born out of frustration with afew
and other initial tagging methods.
notmuch-mailmover is also a rust rewrite of
a feature of afew.