mirror of
https://github.com/oskvr37/tiddl.git
synced 2026-06-13 12:15:13 +03:00
✨ Added 'TIDDL_PATH' env variable for custom HOME_PATH (#109)
This commit is contained in:
@@ -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
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user