Skip to content

Commit eb5b840

Browse files
committed
Got rid of stray click.echos and replaced with cli.utils
1 parent e0b1244 commit eb5b840

File tree

3 files changed

+10
-21
lines changed

3 files changed

+10
-21
lines changed

src/zenml/cli/base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import git
2020

2121
from zenml.cli.cli import cli
22-
from zenml.cli.utils import confirmation
22+
from zenml.cli.utils import confirmation, declare, error
2323
from zenml.core.repo import Repository
2424
from zenml.utils.analytics_utils import INITIALIZE_REPO, track
2525

@@ -45,22 +45,22 @@ def init(
4545
if repo_path is None:
4646
repo_path = os.getcwd()
4747

48-
click.echo(f"Initializing at {repo_path}")
48+
declare(f"Initializing at {repo_path}")
4949

5050
try:
5151
Repository.init_repo(
5252
repo_path=repo_path,
5353
analytics_opt_in=analytics_opt_in,
5454
)
55-
click.echo(f"ZenML repo initialized at {repo_path}")
55+
declare(f"ZenML repo initialized at {repo_path}")
5656
except git.InvalidGitRepositoryError: # type: ignore[attr-defined]
57-
click.echo(
57+
error(
5858
f"{repo_path} is not a valid git repository! Please "
5959
f"initialize ZenML within a git repository using "
6060
f"`git init `"
6161
)
6262
except AssertionError as e:
63-
click.echo(f"{e}")
63+
error(f"{e}")
6464

6565

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

81-
click.echo("Not implemented for this version")
81+
error("Not implemented for this version")
8282
# if confirm:
8383
# repo.clean()

src/zenml/cli/utils.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,6 @@ def declare(text: str) -> None:
6868
click.echo(click.style(text, fg="green"))
6969

7070

71-
def notice(text: str) -> None:
72-
"""Echo a notice string on the CLI.
73-
74-
Args:
75-
text: Input text string.
76-
"""
77-
click.echo(click.style(text, fg="cyan"))
78-
79-
8071
def error(text: str) -> None:
8172
"""Echo an error string on the CLI.
8273

src/zenml/cli/version.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717
from zenml import __version__
1818
from zenml.cli.cli import cli
19+
from zenml.cli.utils import declare
1920

2021

2122
@cli.command()
2223
def version() -> None:
2324
"""Version of ZenML"""
24-
click.echo(
25-
click.style(
26-
r"""
25+
declare(
26+
r"""
2727
.-') _ ('-. .-') _ _ .-')
2828
( OO) )_( OO) ( OO ) )( '.( OO )_
2929
,(_)----.(,------.,--./ ,--,' ,--. ,--.),--.
@@ -33,8 +33,6 @@ def version() -> None:
3333
/ /___ | .--' | |\ | | | | |(| '---.'
3434
| || `---.| | \ | | | | | | |
3535
`--------'`------'`--' `--' `--' `--' `------'
36-
""",
37-
fg="green",
38-
)
36+
"""
3937
)
4038
click.echo(click.style(f"version: {__version__}", bold=True))

0 commit comments

Comments
 (0)