"""cf export-xlsx — экспорт модели в Excel.""" import typer from infrastructure.cli.i18n import t from infrastructure.cli.services import console, load_model from infrastructure.repositories import ExcelRepository, ExcelRepositoryError app = typer.Typer() _repo = ExcelRepository() @app.command(name="export-xlsx") def export_xlsx( path: str = typer.Argument("exports/forecast.xlsx", help=t("cmd.export.arg.path")), ) -> None: """Экспорт модели в Excel""" model = load_model() try: _repo.save(model, path) console.print(t("cmd.export.ok", path=path)) except ExcelRepositoryError as e: console.print(f"[red]{t('cmd.export.err', error=str(e))}[/red]") raise typer.Exit(1)