diff --git a/infrastructure/cli/commands/export_xlsx.py b/infrastructure/cli/commands/export_xlsx.py index 2d30c93..693a916 100644 --- a/infrastructure/cli/commands/export_xlsx.py +++ b/infrastructure/cli/commands/export_xlsx.py @@ -3,14 +3,20 @@ import typer from infrastructure.cli.i18n import t +from infrastructure.cli.paths import EXPORTS_DIR from infrastructure.cli.services import console, load_model from infrastructure.repositories import ExcelRepository, ExcelRepositoryError _repo = ExcelRepository() +# Значение по умолчанию остаётся ровно "exports/forecast.xlsx" (строка в help +# и в аргументе CLI не меняется) — собирается из EXPORTS_DIR во избежание +# дублирования литерала пути. +DEFAULT_EXPORT_PATH: str = str(EXPORTS_DIR / "forecast.xlsx") + def export_xlsx( - path: str = typer.Argument("exports/forecast.xlsx", help=t("cmd.export.arg.path")), + path: str = typer.Argument(DEFAULT_EXPORT_PATH, help=t("cmd.export.arg.path")), ) -> None: """Экспорт модели в Excel""" model = load_model() diff --git a/infrastructure/cli/paths.py b/infrastructure/cli/paths.py index 28a67ef..1d31c7d 100644 --- a/infrastructure/cli/paths.py +++ b/infrastructure/cli/paths.py @@ -4,3 +4,6 @@ from pathlib import Path DATA_DIR: Path = Path("data") MODEL_PATH: Path = DATA_DIR / "model.json" + +# Каталог для экспортируемых .xlsx (по умолчанию — "./exports" относительно CWD). +EXPORTS_DIR: Path = Path("exports")