diff --git a/README.md b/README.md index eed1bd6..e28730b 100644 --- a/README.md +++ b/README.md @@ -50,11 +50,11 @@ mytoolkit templates register /path/to/templates mytoolkit templates list # lists each template with its absolute path ``` -Registry is stored at `~/.config/mytoolkit/templates.json`. +Registry is stored at `~/.mytoolkit/templates.json` (or `$MYTOOLKIT_HOME/templates.json`). ## User config -All user-level config lives under `~/.config/mytoolkit/`: +All user-level config lives under `~/.mytoolkit/` (override with `$MYTOOLKIT_HOME`): | File | Owner | Purpose | |------|-------|---------| @@ -74,7 +74,7 @@ mytoolkit env export # print MYCLI_FOO=... export statements eval "$(mytoolkit env export)" # load into current shell ``` -Legacy `bin/config.json` (in the source dir) is auto-migrated to `~/.config/mytoolkit/env.json` on first run after upgrade. +Legacy `bin/config.json` (in the source dir) is auto-migrated to `~/.mytoolkit/env.json` on first run after upgrade. ## Uninstall @@ -84,4 +84,4 @@ mytoolkit uninstall make uninstall ``` -User config under `~/.config/mytoolkit/` is left in place. +User config under `~/.mytoolkit/` is left in place. diff --git a/bin/commands/mail.py b/bin/commands/mail.py index 0e5465e..4c99e78 100644 --- a/bin/commands/mail.py +++ b/bin/commands/mail.py @@ -3,6 +3,7 @@ import base64 import imaplib import json +import os import re import smtplib from datetime import datetime @@ -16,7 +17,8 @@ import click from bin.utils import handle_errors -CONFIG_PATH = Path.home() / ".config" / "mytoolkit" / "mail.json" +_HOME = Path(os.environ.get("MYTOOLKIT_HOME", Path.home() / ".mytoolkit")) +CONFIG_PATH = _HOME / "mail.json" def load_config(): diff --git a/bin/templates_registry.py b/bin/templates_registry.py index 215113e..ada0746 100644 --- a/bin/templates_registry.py +++ b/bin/templates_registry.py @@ -1,11 +1,13 @@ """External templates registry for md→pdf / md→docx conversion.""" import json +import os from pathlib import Path import click -CONFIG_PATH = Path.home() / ".config" / "mytoolkit" / "templates.json" +_HOME = Path(os.environ.get("MYTOOLKIT_HOME", Path.home() / ".mytoolkit")) +CONFIG_PATH = _HOME / "templates.json" def _read() -> dict: