refactor: migrate all config paths to ~/.mytoolkit with MYTOOLKIT_HOME support
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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():
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user