Files
dvc/dvc/command/root.py
T
Mr. Outis 85cd344152 logger: Use a more _pythonic_ logging
- Uses a formatter for coloring output
- Move the `progress_aware` decorator logic to the logger itself
- Refactor modules so each one uses their own instance of a logger

Close #1753
2019-04-06 18:19:32 -06:00

32 lines
734 B
Python

from __future__ import unicode_literals
import argparse
import os
import logging
from dvc.command.base import CmdBase, append_doc_link
logger = logging.getLogger(__name__)
class CmdRoot(CmdBase):
def run_cmd(self):
return self.run()
def run(self):
logger.info(os.path.relpath(self.repo.root_dir))
return 0
def add_parser(subparsers, parent_parser):
ROOT_HELP = "Relative path to the repository's directory."
root_parser = subparsers.add_parser(
"root",
parents=[parent_parser],
description=append_doc_link(ROOT_HELP, "root"),
help=ROOT_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter,
)
root_parser.set_defaults(func=CmdRoot)