Quellcode durchsuchen

move-files mit vorigem update

gc-server3 vor 1 Woche
Ursprung
Commit
607f9fd892
1 geänderte Dateien mit 15 neuen und 7 gelöschten Zeilen
  1. 15 7
      main.py

+ 15 - 7
main.py

@@ -25,8 +25,8 @@ def app_callback(context: typer.Context) -> None:
         typer.echo(context.get_help())
 
 
-@app.command()
-def clients(
+@app.command("clients")
+def clients_command(
     directory: Path | None = typer.Argument(None, help="Verzeichnis mit XML-Dateien"),
     output: Path = typer.Option(DATA_DIRECTORY / "clients.csv", "--output", "-o", help="Zielpfad der CSV-Datei"),
 ) -> None:
@@ -39,8 +39,8 @@ def clients(
     typer.echo(f"{xml_count} XML-Dateien gelesen, {row_count} Einträge nach {output} geschrieben.")
 
 
-@app.command()
-def files(
+@app.command("files")
+def files_command(
     directory: Path | None = typer.Argument(None, help="Verzeichnis mit XML-Dateien"),
     output: Path = typer.Option(DATA_DIRECTORY / "files.csv", "--output", "-o", help="Zielpfad der CSV-Datei"),
     ignore_timestamp: bool = typer.Option(
@@ -60,14 +60,22 @@ def files(
 
 @app.command("move-files")
 def move_files_command(
+    directory: Path | None = typer.Argument(None, help="Verzeichnis mit XML-Dateien"),
     files_csv: Path = typer.Option(
         DATA_DIRECTORY / "files.csv", "--files-csv", help="CSV-Datei mit den gefundenen Dateien"
     ),
     clients_csv: Path = typer.Option(DATA_DIRECTORY / "clients.csv", "--clients-csv", help="CSV-Datei mit den Kunden"),
     desktop: Path | None = typer.Option(None, "--desktop", help="Desktop-Verzeichnis als Zielbasis"),
+    ignore_timestamp: bool = typer.Option(
+        False,
+        "--ignore-timestamp",
+        help="Ignoriert den Abgleich des Erstellungsdatums mit der Session.",
+    ),
 ) -> None:
     """Verschiebt gefundene Dateien in Desktop/PC-Visit/Kunde."""
+    directory = directory or default_session_history()
     try:
+        run_files(directory, files_csv, ignore_timestamp=ignore_timestamp)
         moved_count, skipped_count, missing_client_count = move_files(
             files_csv, clients_csv, desktop or default_desktop()
         )
@@ -79,7 +87,7 @@ def move_files_command(
 
 
 @app.command("archive-logs")
-def archive_logs(
+def archive_logs_command(
     directory: Path | None = typer.Argument(None, help="Verzeichnis mit XML-Dateien"),
 ) -> None:
     """Archiviert Session-XML-Dateien nach Jahr."""
@@ -91,8 +99,8 @@ def archive_logs(
     typer.echo(f"{checked_count} XML-Dateien geprüft, {archived_count} archiviert, " f"{skipped_count} übersprungen.")
 
 
-@app.command()
-def summary(
+@app.command("summary")
+def summary_command(
     directory: Path | None = typer.Argument(None, help="Verzeichnis mit XML-Dateien"),
     output: Path = typer.Option(DATA_DIRECTORY / "summary.csv", "--output", "-o", help="Zielpfad der CSV-Datei"),
 ) -> None: