Added 'TIDDL_PATH' env variable for custom HOME_PATH (#109)

This commit is contained in:
Oskar Dudziński
2025-03-20 14:28:39 +01:00
committed by GitHub
parent a5a039f6a8
commit 8e93e4ec9a
2 changed files with 19 additions and 4 deletions
+10
View File
@@ -93,6 +93,16 @@ This command will:
More about file templating [on wiki](https://github.com/oskvr37/tiddl/wiki/Template-formatting).
## Custom tiddl home path
You can set `TIDDL_PATH` environment variable to use custom home path for tiddl.
Example CLI usage:
```sh
TIDDL_PATH=~/custom/tiddl tiddl auth login
```
# Development
Clone the repository
+9 -4
View File
@@ -1,15 +1,20 @@
# 3.0 TODO: change config path to ~/.config/tiddl.json
from os import environ, makedirs
from pydantic import BaseModel
from pathlib import Path
from tiddl.models.constants import TrackArg, SinglesFilter
HOME_PATH = Path.home()
TIDDL_ENV_KEY = "TIDDL_PATH"
# 3.0 TODO: rename HOME_PATH to TIDDL_PATH
# 3.0 TODO: add /tiddl to Path.home()
HOME_PATH = Path(environ[TIDDL_ENV_KEY]) if environ.get(TIDDL_ENV_KEY) else Path.home()
makedirs(HOME_PATH, exist_ok=True)
CONFIG_PATH = HOME_PATH / "tiddl.json"
CONFIG_INDENT = 2
class TemplateConfig(BaseModel):
track: str = "{artist} - {title}"
video: str = "{artist} - {title}"