Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

status: Show friendly message for empty project. #4609

Merged
merged 4 commits into from
Sep 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions dvc/command/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from dvc.command.data_sync import CmdDataBase
from dvc.exceptions import DvcException
from dvc.utils import format_link

logger = logging.getLogger(__name__)

Expand All @@ -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 = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use format_link?

def format_link(link):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't argue with that. Fixed in 656efd5.

"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 += ":"
Expand Down Expand Up @@ -61,6 +66,8 @@ def run(self):
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)
skshetry marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
20 changes: 8 additions & 12 deletions dvc/repo/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
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__)
Expand All @@ -22,24 +24,18 @@ 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",
)
)

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)

Expand Down