feat: Use provided argument as basename for clipboard image tempfile

This commit is contained in:
Paul Gauthier (aider) 2024-08-09 07:55:38 -03:00
parent 1e3868e3d0
commit 54ea449394

View file

@ -901,7 +901,8 @@ class Commands:
# Check for image first
image = ImageGrab.grabclipboard()
if isinstance(image, Image.Image):
with tempfile.NamedTemporaryFile(suffix=".png", delete=False) as temp_file:
basename = args.strip() if args.strip() else "clipboard_image"
with tempfile.NamedTemporaryFile(prefix=f"{basename}_", suffix=".png", delete=False) as temp_file:
image.save(temp_file.name, "PNG")
temp_file_path = temp_file.name