mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-01 23:08:43 +01:00
* test: clean flake8 config root clutter * test: pre-commit: add isort Compatible with black (see https://github.com/timothycrosley/isort/issues/694) * lint: reorder imports * lint: more complex imports * lint: fix deepsource * config: isort: add first party dvc * tests: restyled: add isort * temp commit to revert before merge * Revert "temp commit to revert before merge" This reverts commit 11db0fd8e95fe891597cbb9bf804480909b19e24.
36 lines
1016 B
Python
36 lines
1016 B
Python
import argparse
|
|
import logging
|
|
|
|
from dvc.command.base import CmdBase, append_doc_link
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class CmdInstall(CmdBase):
|
|
def run(self):
|
|
try:
|
|
self.repo.install(self.args.use_pre_commit_tool)
|
|
except Exception:
|
|
logger.exception("failed to install DVC Git hooks")
|
|
return 1
|
|
return 0
|
|
|
|
|
|
def add_parser(subparsers, parent_parser):
|
|
INSTALL_HELP = "Install DVC git hooks into the repository."
|
|
install_parser = subparsers.add_parser(
|
|
"install",
|
|
parents=[parent_parser],
|
|
description=append_doc_link(INSTALL_HELP, "install"),
|
|
help=INSTALL_HELP,
|
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
)
|
|
install_parser.add_argument(
|
|
"--use-pre-commit-tool",
|
|
action="store_true",
|
|
default=False,
|
|
help="Install DVC hooks using pre-commit "
|
|
"(https://pre-commit.com) if it is installed.",
|
|
)
|
|
install_parser.set_defaults(func=CmdInstall)
|