mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
* move man doc links to descriptions, fix some help copies * minor init force message fix * deal with ugly inheritance in lock base * remove unnecessary super calls * add return back to python lock/unlock run functions
52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
from __future__ import unicode_literals
|
|
|
|
import argparse
|
|
|
|
import dvc.prompt as prompt
|
|
import dvc.logger as logger
|
|
from dvc.command.base import CmdBase, append_doc_link
|
|
from dvc.exceptions import DvcException
|
|
|
|
|
|
class CmdDestroy(CmdBase):
|
|
def run_cmd(self):
|
|
try:
|
|
statement = (
|
|
"This will destroy all information about your pipelines,"
|
|
" all data files, as well as cache in .dvc/cache."
|
|
"\n"
|
|
"Are you sure you want to continue?"
|
|
)
|
|
|
|
if not self.args.force and not prompt.confirm(statement):
|
|
raise DvcException(
|
|
"cannot destroy without a confirmation from the user."
|
|
" Use '-f' to force."
|
|
)
|
|
|
|
self.repo.destroy()
|
|
except Exception:
|
|
logger.error("failed to destroy DVC")
|
|
return 1
|
|
return 0
|
|
|
|
|
|
def add_parser(subparsers, parent_parser):
|
|
DESTROY_HELP = "Remove DVC files, local DVC config and data cache."
|
|
|
|
destroy_parser = subparsers.add_parser(
|
|
"destroy",
|
|
parents=[parent_parser],
|
|
description=append_doc_link(DESTROY_HELP, "destroy"),
|
|
help=DESTROY_HELP,
|
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
)
|
|
destroy_parser.add_argument(
|
|
"-f",
|
|
"--force",
|
|
action="store_true",
|
|
default=False,
|
|
help="Force destruction.",
|
|
)
|
|
destroy_parser.set_defaults(func=CmdDestroy)
|