mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-06 07:18:28 +01:00
status: Show friendly message for empty project. (#4609)
* status: Show friendly message for empty project. When there are no stages in the repo, show a friendly message to that effect and display a getting-started URL. Fixes #4395. * Fix style check failing due to line too long. (E501) * Use format_link(…) as suggested by @skshetry, vs {blue}/{nc}. Since I'd pulled the old syntax out of repo/init.py, I've fixed that up as well so no one makes that mistake again. Note that this adds <>s around the link text, unlike before: +---------------------------------------------------------------------+ | | | DVC has enabled anonymous aggregate usage analytics. | | Read the analytics documentation (and how to opt-out) here: | | <https://dvc.org/doc/user-guide/analytics> | | | +---------------------------------------------------------------------+ This is probably fine, since if we're going to have a standard link format we might as well stick with it consistently. If we don't like it, we can change format_link() I guess. * Update dvc/command/status.py Co-authored-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
co-authored by
Ruslan Kuprieiev
parent
c94ab359b6
commit
a664059eff
@@ -2,6 +2,7 @@ import logging
|
||||
|
||||
from dvc.command.data_sync import CmdDataBase
|
||||
from dvc.exceptions import DvcException
|
||||
from dvc.utils import format_link
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -10,6 +11,10 @@ class CmdDataStatus(CmdDataBase):
|
||||
STATUS_LEN = 20
|
||||
STATUS_INDENT = "\t"
|
||||
UP_TO_DATE_MSG = "Data and pipelines are up to date."
|
||||
EMPTY_PROJECT_MSG = (
|
||||
"There are no data or pipelines tracked in this project yet.\n"
|
||||
"See {link} to get started!"
|
||||
).format(link=format_link("https://dvc.org/doc/start"))
|
||||
|
||||
def _normalize(self, s):
|
||||
s += ":"
|
||||
@@ -61,6 +66,8 @@ class CmdDataStatus(CmdDataBase):
|
||||
logger.info(json.dumps(st))
|
||||
elif st:
|
||||
self._show(st, indent)
|
||||
elif not self.repo.stages:
|
||||
logger.info(self.EMPTY_PROJECT_MSG)
|
||||
else:
|
||||
logger.info(self.UP_TO_DATE_MSG)
|
||||
|
||||
|
||||
+8
-12
@@ -10,7 +10,9 @@ from dvc.ignore import init as init_dvcignore
|
||||
from dvc.repo import Repo
|
||||
from dvc.scm import SCM
|
||||
from dvc.scm.base import SCMError
|
||||
from dvc.utils import boxify, relpath
|
||||
from dvc.utils import boxify
|
||||
from dvc.utils import format_link as fmt_link
|
||||
from dvc.utils import relpath
|
||||
from dvc.utils.fs import remove
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -22,9 +24,7 @@ def _welcome_message():
|
||||
boxify(
|
||||
"DVC has enabled anonymous aggregate usage analytics.\n"
|
||||
"Read the analytics documentation (and how to opt-out) here:\n"
|
||||
"{blue}https://dvc.org/doc/user-guide/analytics{nc}".format(
|
||||
blue=colorama.Fore.BLUE, nc=colorama.Fore.RESET
|
||||
),
|
||||
+ fmt_link("https://dvc.org/doc/user-guide/analytics"),
|
||||
border_color="red",
|
||||
)
|
||||
)
|
||||
@@ -32,14 +32,10 @@ def _welcome_message():
|
||||
msg = (
|
||||
"{yellow}What's next?{nc}\n"
|
||||
"{yellow}------------{nc}\n"
|
||||
"- Check out the documentation: {blue}https://dvc.org/doc{nc}\n"
|
||||
"- Get help and share ideas: {blue}https://dvc.org/chat{nc}\n"
|
||||
"- Star us on GitHub: {blue}https://github.com/iterative/dvc{nc}"
|
||||
).format(
|
||||
yellow=colorama.Fore.YELLOW,
|
||||
blue=colorama.Fore.BLUE,
|
||||
nc=colorama.Fore.RESET,
|
||||
)
|
||||
f"- Check out the documentation: {fmt_link('https://dvc.org/doc')}\n"
|
||||
f"- Get help and share ideas: {fmt_link('https://dvc.org/chat')}\n"
|
||||
f"- Star us on GitHub: {fmt_link('https://github.com/iterative/dvc')}"
|
||||
).format(yellow=colorama.Fore.YELLOW, nc=colorama.Fore.RESET)
|
||||
|
||||
logger.info(msg)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user