Config: Report author name

This commit is contained in:
Кокос Артем Николаевич
2026-01-21 14:00:13 +07:00
parent e9d3a273cd
commit 9a28d6d9c2
4 changed files with 53 additions and 4 deletions

View File

@@ -2,9 +2,11 @@ import sys
import argparse
from typing import List, Optional
from redminelib.resources import Issue
from .config import Config
from .client import fetch_issues_with_spent_time
from .formatter import format_compact, format_table
from .formatter_odt import format_odt
def parse_date_range(date_arg: str) -> tuple[str, str]:
@@ -36,6 +38,11 @@ def main(argv: Optional[List[str]] = None) -> int:
"--output",
help="Path to output .odt file (e.g., report.odt). If omitted, prints to stdout."
)
parser.add_argument(
"--author",
default="",
help="Override author name from .env (REDMINE_AUTHOR)"
)
args = parser.parse_args(argv)
try:
@@ -67,8 +74,8 @@ def main(argv: Optional[List[str]] = None) -> int:
print("❌ Output file must end with .odt", file=sys.stderr)
return 1
try:
from .formatter_odt import format_odt
doc = format_odt(issue_hours)
author = Config.get_author(args.author)
doc = format_odt(issue_hours, author=author, from_date=from_date, to_date=to_date)
doc.save(args.output)
print(f"✅ Report saved to {args.output}")
except ImportError: