mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-16 16:45:16 +00:00
require confirmation for rm -r
This commit is contained in:
@@ -137,6 +137,8 @@ class Updater:
|
|||||||
continue
|
continue
|
||||||
if self.debug:
|
if self.debug:
|
||||||
self.log.dbg('rm -r {}'.format(new))
|
self.log.dbg('rm -r {}'.format(new))
|
||||||
|
if not self._confirm_rm_r(new):
|
||||||
|
continue
|
||||||
utils.remove(new)
|
utils.remove(new)
|
||||||
|
|
||||||
# handle files diff
|
# handle files diff
|
||||||
@@ -208,3 +210,10 @@ class Updater:
|
|||||||
if self.safe and not self.log.ask(msg):
|
if self.safe and not self.log.ask(msg):
|
||||||
return False
|
return False
|
||||||
return True
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user