mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-19 23:11:44 +01:00
Add dvc version command
This commit is contained in:
@@ -33,6 +33,7 @@ import dvc.command.daemon as daemon
|
||||
import dvc.command.commit as commit
|
||||
import dvc.command.tag as tag
|
||||
import dvc.command.diff as diff
|
||||
import dvc.command.version as version
|
||||
from dvc.exceptions import DvcParserError
|
||||
|
||||
|
||||
@@ -65,6 +66,7 @@ COMMANDS = [
|
||||
commit,
|
||||
tag,
|
||||
diff,
|
||||
version,
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import platform
|
||||
import argparse
|
||||
import logging
|
||||
|
||||
from dvc.command.base import CmdBase, append_doc_link
|
||||
from dvc.version import _BASE_VERSION
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CmdVersion(CmdBase):
|
||||
def run(self):
|
||||
info = (
|
||||
"DVC version: {dvc_version}\n"
|
||||
"Python version: {python_version}\n"
|
||||
"Platform: {platform_type}"
|
||||
).format(
|
||||
dvc_version=_BASE_VERSION,
|
||||
python_version=platform.python_version(),
|
||||
platform_type=platform.platform(),
|
||||
)
|
||||
logger.info(info)
|
||||
return 0
|
||||
|
||||
|
||||
def add_parser(subparsers, parent_parser):
|
||||
ADD_HELP = (
|
||||
"Output the system/environment information along with the DVC version"
|
||||
)
|
||||
|
||||
add_parser = subparsers.add_parser(
|
||||
"version",
|
||||
parents=[parent_parser],
|
||||
description=append_doc_link(ADD_HELP, "version"),
|
||||
help=ADD_HELP,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
)
|
||||
add_parser.set_defaults(func=CmdVersion)
|
||||
Reference in New Issue
Block a user