47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
"""Entry point приложения cf. Регистрирует все команды."""
|
|
|
|
import sys
|
|
|
|
import typer
|
|
|
|
try:
|
|
sys.stdout.reconfigure(encoding="utf-8")
|
|
except (AttributeError, OSError):
|
|
pass
|
|
|
|
from infrastructure.cli.commands import (
|
|
analyze,
|
|
compare,
|
|
config,
|
|
export_xlsx,
|
|
forecast,
|
|
import_xlsx,
|
|
info,
|
|
init,
|
|
scenario,
|
|
whatif,
|
|
)
|
|
from infrastructure.i18n import setup_i18n, t
|
|
|
|
setup_i18n() # язык уже определён при импорте infrastructure.i18n (D20)
|
|
|
|
app = typer.Typer(name="cf", help=t("app.help"))
|
|
|
|
# Команды верхнего уровня
|
|
app.command(name="init")(init.init)
|
|
app.command(name="forecast")(forecast.forecast)
|
|
app.command(name="scenario")(scenario.scenario)
|
|
app.command(name="whatif")(whatif.whatif)
|
|
app.command(name="compare")(compare.compare)
|
|
app.command(name="import-xlsx")(import_xlsx.import_xlsx)
|
|
app.command(name="export-xlsx")(export_xlsx.export_xlsx)
|
|
app.command(name="analyze")(analyze.analyze)
|
|
app.command(name="info")(info.info)
|
|
|
|
# Под-приложение config
|
|
app.add_typer(config.app, name="config")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app()
|