dvc: add confirmation for dvc destroy

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2018-07-15 19:18:01 +03:00
committed by Ruslan Kuprieiev
parent 586fde5f95
commit fef8ea4602
4 changed files with 56 additions and 1 deletions
+12 -1
View File
@@ -1,9 +1,20 @@
from dvc.command.common.base import CmdBase
from dvc.prompt import prompt
class CmdDestroy(CmdBase):
def run(self):
def run_cmd(self):
try:
msg = u'This will destroy all information about your pipelines as ' \
u'well as cache in .dvc/cache.\n' \
u'Are you sure you want to continue?'
if not self.args.force and not prompt(msg, False):
err = u'Cannot destroy without a confirmation from the user. ' \
u'Use \'-f\' to force.'
self.project.logger.error(err)
return 1
self.project.destroy()
except Exception as exc:
self.project.logger.error('Failed to destroy DVC', exc)