From b04907483366373ac8a5f360f336a922fdf3cb87 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Sun, 1 Jan 2017 17:19:50 +0100 Subject: Release config files after command line parsing This was tested with lsof(8) and the files are not open when alot is up and running. --- alot/__main__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'alot/__main__.py') diff --git a/alot/__main__.py b/alot/__main__.py index b8bb6d2c..d68b5b87 100644 --- a/alot/__main__.py +++ b/alot/__main__.py @@ -22,12 +22,12 @@ def main(): version=alot.__version__) parser.add_argument('-r', '--read-only', action='store_true', help='open db in read only mode') - parser.add_argument('-c', '--config', type=argparse.FileType('r'), - help='config file') - parser.add_argument('-n', '--notmuch-config', type=argparse.FileType('r'), - default=os.environ.get( + parser.add_argument('-c', '--config', help='config file', + type=lambda x: argparse.FileType('r')(x).name) + parser.add_argument('-n', '--notmuch-config', default=os.environ.get( 'NOTMUCH_CONFIG', os.path.expanduser('~/.notmuch-config')), + type=lambda x: argparse.FileType('r')(x).name, help='notmuch config') parser.add_argument('-C', '--colour-mode', choices=(1, 16, 256), type=int, default=256, -- cgit v1.2.3