Add initial CLI support
This commit is contained in:
parent
e16d67e2f8
commit
22a9c68611
14 changed files with 168 additions and 26 deletions
19
trovedb/user_env.py
Normal file
19
trovedb/user_env.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
"""Environment for Trove"""
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
TROVE_HOME_DIR: Path = Path.home()
|
||||
TROVE_USER_CONFIG_PATH: Path = TROVE_HOME_DIR / ".trove_config"
|
||||
|
||||
_ENV_TROVEBASE: str|None = os.environ.get("TROVEBASE", None)
|
||||
|
||||
def _search_trovebase() -> Path | str | None:
|
||||
if _ENV_TROVEBASE is not None:
|
||||
return Path(_ENV_TROVEBASE)
|
||||
for path in Path.cwd().parents:
|
||||
if (path / ".trove").exists():
|
||||
return path
|
||||
return None
|
||||
|
||||
TROVEBASE: Path | str | None = _search_trovebase()
|
||||
Loading…
Add table
Add a link
Reference in a new issue