mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-11 07:18:28 +01:00
Merge pull request #782 from efiop/master
dvc: introduce `dvc root` command
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user