Skip to content

Commit

Permalink
status: Show friendly message for empty project.
Browse files Browse the repository at this point in the history
When there are no stages in the repo, show a friendly message to that
effect and display a getting-started URL.

Fixes iterative#2784.
  • Loading branch information
DDR0 committed Sep 23, 2020
1 parent 688da04 commit 3d7b09b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dvc/command/status.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import logging

import colorama

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

Expand All @@ -10,6 +12,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 is no data tracked in this project yet.\n"
"See {blue}https://dvc.org/doc/start/data-versioning{nc} to get started!"
).format(blue=colorama.Fore.BLUE, nc=colorama.Fore.RESET)

def _normalize(self, s):
s += ":"
Expand Down Expand Up @@ -61,6 +67,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)

Expand Down

0 comments on commit 3d7b09b

Please sign in to comment.