Debian Codegraph @

docs/commandline.rst

raw
1 Command Line Usage
2 ==================
3
4 Ultimately afew is a command line tool. You have to specify an action, and
5 whether to act on all messages, or only on new messages. The actions you can
6 choose from are:
7
8 tag
9 run the tag filters. See `Initial tagging`_.
10
11 watch
12 continuously monitor the mailbox for new files
13
14 move-mails
15 move mail files between maildir folders
16
17 Initial tagging
18 ---------------
19
20 Basic tagging stuff requires no configuration, just run
21
22 .. code-block:: sh
23
24 $ afew --tag --new
25 # or to tag *all* messages
26 $ afew --tag --all
27
28 To do this automatically you can add the following hook into your
29 `~/.offlineimaprc`:
30
31 .. code-block:: ini
32
33 postsynchook = ionice -c 3 chrt --idle 0 /bin/sh -c "notmuch new && afew --tag --new"
34
35 There is a lot more to say about general filter :doc:`configuration`
36 and the different :doc:`filters` provided by afew.
37
38 Simulation
39 ^^^^^^^^^^
40
41 Adding `--dry-run` to any `--tag` or `--sync-tags` action prevents
42 modification of the notmuch db. Add some `-vv` goodness to see some
43 action.
44
45 Move Mode
46 ---------
47
48 To invoke afew in move mode, provide the `--move-mails` option on the
49 command line. Move mode will respect `--dry-run`, so throw in
50 `--verbose` and watch what effects a real run would have.
51
52 In move mode, afew will check all mails (or only recent ones) in the
53 configured maildir folders, deciding whether they should be moved to
54 another folder.
55
56 The decision is based on rules defined in your config file. A rule is
57 bound to a source folder and specifies a target folder into which a
58 mail will be moved that is matched by an associated query.
59
60 This way you will be able to transfer your sorting principles roughly
61 to the classic folder based maildir structure understood by your
62 traditional mail server. Tag your mails with notmuch, call afew
63 `--move-mails` in an offlineimap presynchook and enjoy a clean inbox
64 in your webinterface/GUI-client at work.
65
66 Note that in move mode, afew calls `notmuch new` after moving mails around.
67 You can use `afew -m --notmuch-args=--no-hooks` in a pre-new notmuch hook
68 to avoid loops.
69
70 For information on how to configure rules for move mode, what you can
71 do with it and what you can't, please refer to :doc:`move_mode`.
72
73 Commandline help
74 ----------------
75
76 The full set of options is:
77
78 .. code-block:: sh
79
80 $ afew --help
81 Usage: afew [options] [--] [query]
82
83 Options:
84 -h, --help show this help message and exit
85
86 Actions:
87 Please specify exactly one action.
88
89 -t, --tag run the tag filters
90 -w, --watch continuously monitor the mailbox for new files
91 -m, --move-mails move mail files between maildir folders
92
93 Query modifiers:
94 Please specify either --all or --new or a query string.
95
96 -a, --all operate on all messages
97 -n, --new operate on all new messages
98
99 General options:
100 -C NOTMUCH_CONFIG, --notmuch-config=NOTMUCH_CONFIG
101 path to the notmuch configuration file [default:
102 $NOTMUCH_CONFIG or ~/.notmuch-config]
103 -e ENABLE_FILTERS, --enable-filters=ENABLE_FILTERS
104 filter classes to use, separated by ',' [default:
105 filters specified in afew's config]
106 -d, --dry-run don't change the db [default: False]
107 -R REFERENCE_SET_SIZE, --reference-set-size=REFERENCE_SET_SIZE
108 size of the reference set [default: 1000]
109 -T DAYS, --reference-set-timeframe=DAYS
110 do not use mails older than DAYS days [default: 30]
111 -v, --verbose be more verbose, can be given multiple times