Skip to content

Commit

Permalink
🎨 Refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: zethson <[email protected]>
  • Loading branch information
Zethson committed Jul 29, 2024
1 parent 2d57def commit af73896
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lamin_cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
from importlib.metadata import PackageNotFoundError, version
from typing import Optional, Mapping

try:
lamindb_version = version("lamindb")
except PackageNotFoundError:
lamindb_version = "lamindb installation not found"

# https://github.com/ewels/rich-click/issues/19
# Otherwise rich-click takes over the formatting.
if os.environ.get("NO_RICH"):
Expand All @@ -30,7 +25,7 @@ def __init__(
def list_commands(self, ctx: click.Context) -> Mapping[str, click.Command]:
return self.commands

group_decorator = click.group(cls=OrderedGroup)
lamin_group_decorator = click.group(cls=OrderedGroup)

else:
import rich_click as click
Expand Down Expand Up @@ -64,7 +59,7 @@ def list_commands(self, ctx: click.Context) -> Mapping[str, click.Command]:
]
}

group_decorator = click.rich_config(
lamin_group_decorator = click.rich_config(
help_config=click.RichHelpConfiguration(
command_groups=COMMAND_GROUPS,
style_commands_table_column_width_ratio=(1, 13),
Expand All @@ -78,7 +73,12 @@ def list_commands(self, ctx: click.Context) -> Mapping[str, click.Command]:
from lamin_cli._cache import cache
from lamin_cli._migration import migrate

@group_decorator
try:
lamindb_version = version("lamindb")
except PackageNotFoundError:
lamindb_version = "lamindb installation not found"

@lamin_group_decorator
@click.version_option(version=lamindb_version, prog_name="lamindb")
def main():
"""Configure LaminDB and perform simple actions."""
Expand Down

0 comments on commit af73896

Please sign in to comment.