dissertation/where_fi/cli/globals.py
Christos Falas 381dcaa0bc
[BROKEN] Add CLI option for option
This is still slightly broken, as new processes are not able to access
the configuration.
2025-01-27 16:16:40 +00:00

33 lines
841 B
Python

from functools import partial
from pathlib import Path
from typing import Annotated
import typer
from .. import collection
from .. import config as config_mod
from ..collection import file, ingest
csi_producer: collection.CSIProducer = collection.noop
is_live = True
def main(
from_file: Annotated[
Path | None,
typer.Option(help="Read CSI data from file. Uses live data if not specified"),
] = None,
config: Annotated[
Path, typer.Option(help="Specify path to config file", exists=True)
] = Path("config.yaml"),
) -> None:
global csi_producer, is_live, config_path
if from_file:
csi_producer = partial(file.start_processing, file_path=from_file)
is_live = False
else:
csi_producer = ingest.start_processing
is_live = True
config_mod.load(config)