Skip to content

Commit

Permalink
Got rid of stray click.echos and replaced with cli.utils
Browse files Browse the repository at this point in the history
  • Loading branch information
htahir1 committed Nov 5, 2021
1 parent e0b1244 commit eb5b840
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
12 changes: 6 additions & 6 deletions src/zenml/cli/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import git

from zenml.cli.cli import cli
from zenml.cli.utils import confirmation
from zenml.cli.utils import confirmation, declare, error
from zenml.core.repo import Repository
from zenml.utils.analytics_utils import INITIALIZE_REPO, track

Expand All @@ -45,22 +45,22 @@ def init(
if repo_path is None:
repo_path = os.getcwd()

click.echo(f"Initializing at {repo_path}")
declare(f"Initializing at {repo_path}")

try:
Repository.init_repo(
repo_path=repo_path,
analytics_opt_in=analytics_opt_in,
)
click.echo(f"ZenML repo initialized at {repo_path}")
declare(f"ZenML repo initialized at {repo_path}")
except git.InvalidGitRepositoryError: # type: ignore[attr-defined]
click.echo(
error(
f"{repo_path} is not a valid git repository! Please "
f"initialize ZenML within a git repository using "
f"`git init `"
)
except AssertionError as e:
click.echo(f"{e}")
error(f"{e}")


@cli.command("clean")
Expand All @@ -78,6 +78,6 @@ def clean(yes: bool = False) -> None:
"Are you sure you want to proceed?"
)

click.echo("Not implemented for this version")
error("Not implemented for this version")
# if confirm:
# repo.clean()
9 changes: 0 additions & 9 deletions src/zenml/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,6 @@ def declare(text: str) -> None:
click.echo(click.style(text, fg="green"))


def notice(text: str) -> None:
"""Echo a notice string on the CLI.
Args:
text: Input text string.
"""
click.echo(click.style(text, fg="cyan"))


def error(text: str) -> None:
"""Echo an error string on the CLI.
Expand Down
10 changes: 4 additions & 6 deletions src/zenml/cli/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

from zenml import __version__
from zenml.cli.cli import cli
from zenml.cli.utils import declare


@cli.command()
def version() -> None:
"""Version of ZenML"""
click.echo(
click.style(
r"""
declare(
r"""
.-') _ ('-. .-') _ _ .-')
( OO) )_( OO) ( OO ) )( '.( OO )_
,(_)----.(,------.,--./ ,--,' ,--. ,--.),--.
Expand All @@ -33,8 +33,6 @@ def version() -> None:
/ /___ | .--' | |\ | | | | |(| '---.'
| || `---.| | \ | | | | | | |
`--------'`------'`--' `--' `--' `--' `------'
""",
fg="green",
)
"""
)
click.echo(click.style(f"version: {__version__}", bold=True))

0 comments on commit eb5b840

Please sign in to comment.