Verified Commit 3d9f8d46 authored by Jakob Moser's avatar Jakob Moser
Browse files

Implement move instruction

parent f2c0e5a4
Loading
Loading
Loading
Loading
+5 −1
Changes for karaokatalog/instructions/MoveInstruction.py: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
import shutil
from dataclasses import dataclass
from pathlib import Path

@@ -15,4 +16,7 @@ class MoveInstruction(Instruction):
    new_path: Path

    def __call__(self) -> None:
        raise NotImplementedError()  # TODO
        if self.new_path.exists():
            raise FileExistsError("New path already exists, not moving anything")

        shutil.move(self.old_path, self.new_path)