refactor smal => mxsmal
This commit is contained in:
parent
3f6be78685
commit
7e984ef129
37 changed files with 142 additions and 72 deletions
19
mxsmal/src/pymxutils/mxutils/click.py
Normal file
19
mxsmal/src/pymxutils/mxutils/click.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Copyright (C) 2026 saces@c-base.org
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
from functools import partial, wraps
|
||||
|
||||
import click
|
||||
|
||||
|
||||
def click_catch_exception(func=None, *, handle):
|
||||
if not func:
|
||||
return partial(click_catch_exception, handle=handle)
|
||||
|
||||
@wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
except handle as e:
|
||||
raise click.ClickException(e)
|
||||
|
||||
return wrapper
|
||||
Loading…
Add table
Add a link
Reference in a new issue