Skip to content

Commit

Permalink
chore: remove catch group class
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulFarault committed Jul 15, 2024
1 parent fdeca28 commit f7c6e1a
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions tdp/cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])


class CatchGroup(click.Group):
"""Catch exceptions and print them to stderr."""

def __call__(self, *args, **kwargs):
try:
return self.main(*args, **kwargs)

except Exception as e:
click.echo(f"Error: {e}", err=True)


def load_env(ctx: click.Context, param: click.Parameter, value: Path) -> Optional[Path]:
"""Click callback to load the environment file."""
if value.exists():
Expand All @@ -44,7 +33,7 @@ def load_env(ctx: click.Context, param: click.Parameter, value: Path) -> Optiona
logging.warning(f"Environment file {value} does not exist.")


@click.group("tdp", context_settings=CONTEXT_SETTINGS, cls=CatchGroup)
@click.group("tdp", context_settings=CONTEXT_SETTINGS)
@click.option(
"--env",
default=".env",
Expand Down

0 comments on commit f7c6e1a

Please sign in to comment.