remove old config compat, use ~/.config/mytoolkit only
This commit is contained in:
+2
-17
@@ -15,30 +15,15 @@ import click
|
||||
|
||||
from bin.utils import handle_errors
|
||||
|
||||
OLD_CONFIG_PATH = Path.home() / ".myclaude" / "mail.json"
|
||||
CONFIG_PATH = Path.home() / ".config" / "mytoolkit" / "mail.json"
|
||||
|
||||
|
||||
def _resolve_config_path() -> Path:
|
||||
"""Return active config path, migrating from old location if needed."""
|
||||
if CONFIG_PATH.exists():
|
||||
return CONFIG_PATH
|
||||
if OLD_CONFIG_PATH.exists():
|
||||
CONFIG_PATH.parent.mkdir(parents=True, exist_ok=True)
|
||||
import shutil
|
||||
shutil.copy2(OLD_CONFIG_PATH, CONFIG_PATH)
|
||||
click.echo(f"Migrated config: {OLD_CONFIG_PATH} -> {CONFIG_PATH}")
|
||||
return CONFIG_PATH
|
||||
return CONFIG_PATH
|
||||
|
||||
|
||||
def load_config():
|
||||
"""Load mail config."""
|
||||
path = _resolve_config_path()
|
||||
if not path.exists():
|
||||
if not CONFIG_PATH.exists():
|
||||
click.echo("Mail not configured. Run: mytoolkit mail config", err=True)
|
||||
raise click.Abort()
|
||||
with open(path, encoding="utf-8") as f:
|
||||
with open(CONFIG_PATH, encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user