This repository was archived by the owner on Nov 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -254,17 +254,20 @@ def bak_down_cmd(filename: Path,
254254 elif not bakfile_entry :
255255 return
256256 if not destination :
257- destination = bakfile_entry .orig_abspath
257+ destination = Path ( bakfile_entry .orig_abspath ). expanduser ()
258258
259259 if quiet :
260260 confirm = 'y'
261261 else :
262- confirm_prompt = f"Confirm: Restore { filename } to { destination } and erase bakfiles?\n " \
262+ if destination != bakfile_entry .orig_abspath :
263+ if destination .exists ():
264+ confirm = click .confirm (f"Overwrite { destination } ?" )
265+
266+ confirm_prompt = f"Confirm: Restore { filename } to { destination } and erase bakfiles?" \
263267 if not keep_bakfile else \
264- f"Confirm: Restore { filename } to { destination } and keep bakfiles?\n "
265- confirm_prompt += "(y/n)"
266- confirm = click .prompt (confirm_prompt , default = 'n' )
267- if confirm .lower ()[0 ] != 'y' :
268+ f"Confirm: Restore { filename } to { destination } and keep bakfiles?"
269+ confirm = click .confirm (confirm_prompt , default = False )
270+ if not confirm :
268271 console .print ("Cancelled." )
269272 return
270273 if not keep_bakfile :
You can’t perform that action at this time.
0 commit comments