From 65b29098b5358b5c284ba5ae034a096d00d34d44 Mon Sep 17 00:00:00 2001 From: neingeist Date: Mon, 28 Sep 2015 08:45:02 +0200 Subject: [PATCH] maildir-zero: allow configuring in a config file --- maildir-zero | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/maildir-zero b/maildir-zero index a9ebe81..9fdeeef 100755 --- a/maildir-zero +++ b/maildir-zero @@ -7,7 +7,7 @@ from __future__ import division, print_function import os import os.path import re - +import yaml def maildirs(startdir): for dirpath, dirnames, _ in os.walk(startdir): @@ -35,9 +35,15 @@ def mailbox_name(maildir, root): return name -ignore_zero = True -ignore = [r'spam'] -sort_by_count = True +config_filename = '~/.config/maildir-zero.yml' +config = {} +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')