From 634205cd7b928993e7c801f770fa15ccb88d7457 Mon Sep 17 00:00:00 2001 From: Paul Jimenez Date: Thu, 25 Jul 2024 19:27:48 -0400 Subject: [PATCH] fix init_config to always run --- mhi/main.py | 15 +++++++-------- pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/mhi/main.py b/mhi/main.py index bf9689b..a13b365 100755 --- a/mhi/main.py +++ b/mhi/main.py @@ -1083,8 +1083,15 @@ def _dispatch(args): config.write() state.write() +def init_config(): + global config, state + cfgdir = os.environ.get('HOME', '') + config = ConfigObj(infile=f"{cfgdir}/.mhirc", create_empty=True) + state = ConfigObj(infile=f"{cfgdir}/.mhistate", create_empty=True) + def _cmd_dispatch(args): + init_config() try: _dispatch(args) except KeyboardInterrupt: @@ -1097,14 +1104,6 @@ def cmd_main(): _cmd_dispatch(['mhi', cmd] + sys.argv[1:]) -def init_config(): - global config, state - cfgdir = os.environ.get('HOME', '') - config = ConfigObj(infile=f"{cfgdir}/.mhirc", create_empty=True) - state = ConfigObj(infile=f"{cfgdir}/.mhistate", create_empty=True) - - def main(): - init_config() # main program _cmd_dispatch(sys.argv) diff --git a/pyproject.toml b/pyproject.toml index ec8115a..2467b23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "mhi" -version = "0.8.5" +version = "0.8.6" requires-python = ">=3.8" description = "MH for IMAP" readme = "README.md"