diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-06-16 15:44:59 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-07-10 17:04:06 -0700 |
commit | 86186a242c11fcbc501e7afc791a50187e0dd574 (patch) | |
tree | 59a26b3c6237a236f7d5f9c58aa4b70305f502a4 /alot/__main__.py | |
parent | 3056cc47bd2ea377ee5599b3f218ecff96fbb833 (diff) |
settings: Add a reload method
This patch does a bit of refactoring to the Settings class for it's
setup, and adds a reload method. The refactoring encapsulates the
handling of NoneType for the read_*config methods, and reworks the
constructor just a bit so that it doesn't rely on calling methods to
create instance variables.
The end result is slightly cleaner, and will be useful for adding a
reload command to alot itself.
Diffstat (limited to 'alot/__main__.py')
-rw-r--r-- | alot/__main__.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/alot/__main__.py b/alot/__main__.py index 48826f53..aba380ba 100644 --- a/alot/__main__.py +++ b/alot/__main__.py @@ -95,14 +95,16 @@ def main(): alotconfig = os.path.join( os.environ.get('XDG_CONFIG_HOME', os.path.expanduser('~/.config')), 'alot', 'config') - if not os.path.exists(alotconfig): - alotconfig = None + if os.path.exists(alotconfig): + settings.alot_rc_path = alotconfig else: - alotconfig = options.config + settings.alot_rc_path = options.config + + settings.notmuch_rc_path = options.notmuch_config try: - settings.read_config(alotconfig) - settings.read_notmuch_config(options.notmuch_config) + settings.read_config() + settings.read_notmuch_config() except (ConfigError, OSError, IOError) as e: sys.exit(e) |