diff --git a/dvc/cli.py b/dvc/cli.py index af3d7d568..7d6f553b9 100644 --- a/dvc/cli.py +++ b/dvc/cli.py @@ -20,6 +20,7 @@ from dvc.command.checkout import CmdCheckout from dvc.command.remote import CmdRemoteAdd, CmdRemoteRemove, CmdRemoteModify, CmdRemoteList from dvc.command.metrics import CmdMetricsShow, CmdMetricsAdd, CmdMetricsRemove from dvc.command.install import CmdInstall +from dvc.command.root import CmdRoot from dvc.stage import Stage from dvc import VERSION @@ -451,6 +452,13 @@ def parse_args(argv=None): help='Install dvc hooks into the repository') install_parser.set_defaults(func=CmdInstall) + # Root + root_parser = subparsers.add_parser( + 'root', + parents=[parent_parser], + help='Relative path to project\'s directory') + root_parser.set_defaults(func=CmdRoot) + args = parser.parse_args(argv) return args diff --git a/dvc/command/root.py b/dvc/command/root.py new file mode 100644 index 000000000..99890da4f --- /dev/null +++ b/dvc/command/root.py @@ -0,0 +1,9 @@ +import os + +from dvc.command.common.base import CmdBase + + +class CmdRoot(CmdBase): + def run(self): + self.project.logger.info(os.path.relpath(self.project.root_dir)) + return 0