feat: add report.no_time config option for automatic modes

Add YAML section `report.no_time` that controls `--no-time` behavior
in automatic modes (`--commit`, `--send`). CLI flag `--no-time`
always wins. Manual `--output` ignores the YAML setting.

- Config.get_report_no_time() reads the YAML value (defaults to false)
- cli._resolve_no_time() encapsulates CLI > YAML priority
- --init-config now generates the report section
- docs updated in README.md and docs/CONFIG.md

Closes #49
This commit is contained in:
Кокос Артем Николаевич
2026-07-10 14:38:07 +07:00
parent 5e1c366a60
commit 863ad50cc3
6 changed files with 377 additions and 4 deletions

View File

@@ -61,6 +61,7 @@ class AppConfig:
output_dir: str = ""
output_filename: str = "{author}_{from}_{to}.{ext}"
output_default_format: str = "xlsx"
report_no_time: bool = False
email: EmailConfig = field(default_factory=EmailConfig)
@classmethod
@@ -86,6 +87,7 @@ class AppConfig:
"redmine",
"period",
"output",
"report",
"email",
}
for key in raw:
@@ -108,6 +110,7 @@ class AppConfig:
or "{author}_{from}_{to}.{ext}",
output_default_format=cls._resolve_str(raw, "output", "default_format")
or "xlsx",
report_no_time=cls._resolve_bool(raw, "report", "no_time"),
email=cls._resolve_email(raw),
)
@@ -344,6 +347,13 @@ class Config:
return cls._app.output_default_format or "xlsx"
return "xlsx"
@classmethod
def get_report_no_time(cls) -> bool:
"""Возвращает report.no_time из YAML-конфига (по умолчанию False)."""
if cls._app:
return cls._app.report_no_time
return False
@classmethod
def get_email_config(cls) -> "EmailConfig | None":
"""Возвращает EmailConfig из YAML-конфига или None, если не настроен."""