Skip to content

Commit

Permalink
fix init_config to always run
Browse files Browse the repository at this point in the history
  • Loading branch information
pjz committed Jul 25, 2024
1 parent 4adf841 commit 634205c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions mhi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 634205c

Please sign in to comment.