rename CLI param

This commit is contained in:
Rob committed 2026-03-27 13:19:24 +01:00
1 parent f716feaa3e
commit deb63c857e
1 file changed
+13 -13
+13 -13
View File
@@ -34,14 +34,14 @@ def cli() -> None:
help="Pfad zur Excel-Datei (z. B. Anwesenheit_2026.xlsx)", help="Pfad zur Excel-Datei (z. B. Anwesenheit_2026.xlsx)",
) )
@click.option( @click.option(
"--sheet", "--month",
required=True, required=True,
help="Name des Monats-Sheets (z. B. Feb, Mär, Jan)", help="Name des Monats-Sheets (z. B. Feb, Mrz, Jan)",
) )
def validate_cmd(excel_file: str, sheet: str) -> None: def validate_cmd(excel_file: str, month: str) -> None:
"""Nur Validierung und Vorschau – keine PDFs werden erzeugt.""" """Nur Validierung und Vorschau – keine PDFs werden erzeugt."""
config = load_config() config = load_config()
errors = validate(excel_file, sheet) errors = validate(excel_file, month)
try: try:
year = extract_year_from_filename(excel_file, config) year = extract_year_from_filename(excel_file, config)
@@ -49,12 +49,12 @@ def validate_cmd(excel_file: str, sheet: str) -> None:
year = 0 year = 0
try: try:
persons = extract_persons(excel_file, sheet, config) persons = extract_persons(excel_file, month, config)
person_count = len(persons) person_count = len(persons)
except Exception: except Exception:
person_count = 0 person_count = 0
show_preview_and_confirm(excel_file, sheet, year, person_count, config, errors) show_preview_and_confirm(excel_file, month, year, person_count, config, errors)
if errors: if errors:
click.echo("\nValidierung fehlgeschlagen. Keine PDFs erzeugt.") click.echo("\nValidierung fehlgeschlagen. Keine PDFs erzeugt.")
@@ -72,9 +72,9 @@ def validate_cmd(excel_file: str, sheet: str) -> None:
help="Pfad zur Excel-Datei (z. B. Anwesenheit_2026.xlsx)", help="Pfad zur Excel-Datei (z. B. Anwesenheit_2026.xlsx)",
) )
@click.option( @click.option(
"--sheet", "--month",
required=True, required=True,
help="Name des Monats-Sheets (z. B. Feb, Mär, Jan)", help="Name des Monats-Sheets (z. B. Feb, Mrz, Jan)",
) )
@click.option( @click.option(
"--out", "--out",
@@ -84,12 +84,12 @@ def validate_cmd(excel_file: str, sheet: str) -> None:
type=click.Path(file_okay=False, dir_okay=True), type=click.Path(file_okay=False, dir_okay=True),
help="Ausgabeverzeichnis (Standard: output/ aus config.json)", help="Ausgabeverzeichnis (Standard: output/ aus config.json)",
) )
def generate_cmd(excel_file: str, sheet: str, output_dir: str | None) -> None: def generate_cmd(excel_file: str, month: str, output_dir: str | None) -> None:
"""Liest Excel-Daten und erzeugt eine PDF-Datei pro Teilnehmer.""" """Liest Excel-Daten und erzeugt eine PDF-Datei pro Teilnehmer."""
config = load_config() config = load_config()
# --- Validation ---------------------------------------------------------- # --- Validation ----------------------------------------------------------
errors = validate(excel_file, sheet) errors = validate(excel_file, month)
try: try:
year = extract_year_from_filename(excel_file, config) year = extract_year_from_filename(excel_file, config)
@@ -98,14 +98,14 @@ def generate_cmd(excel_file: str, sheet: str, output_dir: str | None) -> None:
sys.exit(1) sys.exit(1)
try: try:
persons = extract_persons(excel_file, sheet, config) persons = extract_persons(excel_file, month, config)
except Exception as exc: except Exception as exc:
click.echo(f"Fehler beim Lesen der Teilnehmer: {exc}", err=True) click.echo(f"Fehler beim Lesen der Teilnehmer: {exc}", err=True)
sys.exit(1) sys.exit(1)
# --- Preview + confirmation ---------------------------------------------- # --- Preview + confirmation ----------------------------------------------
confirmed = show_preview_and_confirm( confirmed = show_preview_and_confirm(
excel_file, sheet, year, len(persons), config, errors excel_file, month, year, len(persons), config, errors
) )
if not confirmed: if not confirmed:
click.echo("Abgebrochen. Keine PDFs erzeugt.") click.echo("Abgebrochen. Keine PDFs erzeugt.")
@@ -127,7 +127,7 @@ def generate_cmd(excel_file: str, sheet: str, output_dir: str | None) -> None:
for person in persons: for person in persons:
try: try:
attendance = extract_attendance(excel_file, sheet, person, year, config) attendance = extract_attendance(excel_file, month, person, year, config)
output_filename = f"{person.filename_safe_name}.pdf" output_filename = f"{person.filename_safe_name}.pdf"
output_path = out_dir / output_filename output_path = out_dir / output_filename
fill_pdf(attendance, template_path, output_path, config) fill_pdf(attendance, template_path, output_path, config)