1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 18:34:48 +00:00

require confirmation for rm -r

This commit is contained in:
deadc0de6
2018-07-20 23:44:49 +02:00
parent cb99326717
commit 13abdf3357

View File

@@ -137,6 +137,8 @@ class Updater:
continue
if self.debug:
self.log.dbg('rm -r {}'.format(new))
if not self._confirm_rm_r(new):
continue
utils.remove(new)
# handle files diff
@@ -208,3 +210,10 @@ class Updater:
if self.safe and not self.log.ask(msg):
return False
return True
def _confirm_rm_r(self, directory):
"""ask for rm -r directory"""
msg = 'Recursively remove \"{}\"?'.format(directory)
if self.safe and not self.log.ask(msg):
return False
return True