maildir-zero: allow configuring in a config file

master
neingeist 9 years ago
parent 1bbbabac26
commit 65b29098b5

@ -7,7 +7,7 @@ from __future__ import division, print_function
import os import os
import os.path import os.path
import re import re
import yaml
def maildirs(startdir): def maildirs(startdir):
for dirpath, dirnames, _ in os.walk(startdir): for dirpath, dirnames, _ in os.walk(startdir):
@ -35,9 +35,15 @@ def mailbox_name(maildir, root):
return name return name
ignore_zero = True config_filename = '~/.config/maildir-zero.yml'
ignore = [r'spam'] config = {}
sort_by_count = True try:
config = yaml.load(open(os.path.expanduser(config_filename)))
except:
pass
ignore_zero = config.setdefault('ignore_zero', True)
ignore = config.setdefault('ignore', [r'spam'])
sort_by_count = config.setdefault('sort_by_count', True)
root = os.path.expanduser('~/Maildir') root = os.path.expanduser('~/Maildir')

Loading…
Cancel
Save