rename CLI param
This commit is contained in:
1 parent
f716feaa3e
commit
deb63c857e
1 file changed
+13
-13
+13
-13
@@ -34,14 +34,14 @@ def cli() -> None:
|
||||
help="Pfad zur Excel-Datei (z. B. Anwesenheit_2026.xlsx)",
|
||||
)
|
||||
@click.option(
|
||||
"--sheet",
|
||||
"--month",
|
||||
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."""
|
||||
config = load_config()
|
||||
errors = validate(excel_file, sheet)
|
||||
errors = validate(excel_file, month)
|
||||
|
||||
try:
|
||||
year = extract_year_from_filename(excel_file, config)
|
||||
@@ -49,12 +49,12 @@ def validate_cmd(excel_file: str, sheet: str) -> None:
|
||||
year = 0
|
||||
|
||||
try:
|
||||
persons = extract_persons(excel_file, sheet, config)
|
||||
persons = extract_persons(excel_file, month, config)
|
||||
person_count = len(persons)
|
||||
except Exception:
|
||||
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:
|
||||
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)",
|
||||
)
|
||||
@click.option(
|
||||
"--sheet",
|
||||
"--month",
|
||||
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(
|
||||
"--out",
|
||||
@@ -84,12 +84,12 @@ def validate_cmd(excel_file: str, sheet: str) -> None:
|
||||
type=click.Path(file_okay=False, dir_okay=True),
|
||||
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."""
|
||||
config = load_config()
|
||||
|
||||
# --- Validation ----------------------------------------------------------
|
||||
errors = validate(excel_file, sheet)
|
||||
errors = validate(excel_file, month)
|
||||
|
||||
try:
|
||||
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)
|
||||
|
||||
try:
|
||||
persons = extract_persons(excel_file, sheet, config)
|
||||
persons = extract_persons(excel_file, month, config)
|
||||
except Exception as exc:
|
||||
click.echo(f"Fehler beim Lesen der Teilnehmer: {exc}", err=True)
|
||||
sys.exit(1)
|
||||
|
||||
# --- Preview + confirmation ----------------------------------------------
|
||||
confirmed = show_preview_and_confirm(
|
||||
excel_file, sheet, year, len(persons), config, errors
|
||||
excel_file, month, year, len(persons), config, errors
|
||||
)
|
||||
if not confirmed:
|
||||
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:
|
||||
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_path = out_dir / output_filename
|
||||
fill_pdf(attendance, template_path, output_path, config)
|
||||
|
||||
Reference in new issue
Block a user