Skip to content
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
11 changes: 2 additions & 9 deletions elementary/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import click

import elementary.cli.logo
import elementary.cli.upgrade
from elementary.config.config import Config
from elementary.monitor.cli import monitor, report, send_report
Expand All @@ -11,15 +12,7 @@
from elementary.utils import package
from elementary.utils.log import get_logger, set_root_logger_handlers

ELEMENTARY_LOGO = r"""
________ __
/ ____/ /__ ____ ___ ___ ____ / /_____ ________ __
/ __/ / / _ \/ __ `__ \/ _ \/ __ \/ __/ __ `/ ___/ / / /
/ /___/ / __/ / / / / / __/ / / / /_/ /_/ / / / /_/ /
/_____/_/\___/_/ /_/ /_/\___/_/ /_/\__/\__,_/_/ \__, /
/____/
"""
click.echo(f"{ELEMENTARY_LOGO}\n")
elementary.cli.logo.print_elementary_logo()
elementary.cli.upgrade.recommend_version_upgrade()

logger = get_logger(__name__)
Expand Down
21 changes: 21 additions & 0 deletions elementary/cli/logo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import click

from elementary.config.config import Config

ELEMENTARY_LOGO = r"""
________ __
/ ____/ /__ ____ ___ ___ ____ / /_____ ________ __
/ __/ / / _ \/ __ `__ \/ _ \/ __ \/ __/ __ `/ ___/ / / /
/ /___/ / __/ / / / / / __/ / / / /_/ /_/ / / / /_/ /
/_____/_/\___/_/ /_/ /_/\___/_/ /_/\__/\__,_/_/ \__, /
/____/
"""


def print_elementary_logo():
config = Config()

if config.disable_elementary_logo_print:
return
else:
click.echo(f"{ELEMENTARY_LOGO}\n")
4 changes: 4 additions & 0 deletions elementary/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ def __init__(
"disable_elementary_version_check", False
)

self.disable_elementary_logo_print = config.get(
"disable_elementary_logo_print", False
)

def _load_configuration(self) -> dict:
if not os.path.exists(self.config_dir):
os.makedirs(self.config_dir)
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/config/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"workflows": False,
},
"disable_elementary_version_check": True,
"disable_elementary_logo_print": True,
}

WORKFLOWS_CONFIG = {
Expand Down Expand Up @@ -63,6 +64,13 @@ def test_disable_elementary_version_check(config: Config):
)


@pytest.mark.parametrize("config", [CONFIG], indirect=["config"])
def test_disable_elementary_logo_print(config: Config):
assert (
config.disable_elementary_logo_print == CONFIG["disable_elementary_logo_print"]
)


@pytest.mark.parametrize("config", [WORKFLOWS_CONFIG], indirect=["config"])
def test_slack_workflows_config_get_workflows(config: Config):
assert config.is_slack_workflow == WORKFLOWS_CONFIG["slack"]["workflows"]
Loading