Add invoke as task runner, ruff and fix mypy errors
This commit is contained in:
8
files/gramps/gramps_rename.py
Executable file → Normal file
8
files/gramps/gramps_rename.py
Executable file → Normal file
@@ -9,7 +9,9 @@ def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Rename Gramps document files by appending extensions from a list."
|
||||
)
|
||||
parser.add_argument("directory", type=Path, help="Directory containing hashed files")
|
||||
parser.add_argument(
|
||||
"directory", type=Path, help="Directory containing hashed files"
|
||||
)
|
||||
parser.add_argument("names_file", type=Path, help="Text file with target names")
|
||||
return parser.parse_args()
|
||||
|
||||
@@ -33,7 +35,9 @@ def rename_files(directory: Path, names: list[str]) -> None:
|
||||
for name in names:
|
||||
hash_part, dot, _ = name.partition(".")
|
||||
if not dot:
|
||||
print(f"Skipping invalid entry (missing extension): {name}", file=sys.stderr)
|
||||
print(
|
||||
f"Skipping invalid entry (missing extension): {name}", file=sys.stderr
|
||||
)
|
||||
continue
|
||||
|
||||
source = directory / hash_part
|
||||
|
||||
Reference in New Issue
Block a user