10000 update-rich-click by Tochiaha · Pull Request #709 · freelabz/secator · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

update-rich-click #709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dependencies = [
'pydantic < 3',
'requests < 3',
'rich < 14',
'rich-click < 1.7',
'rich-click >= 1.8',
'click < 8.2.0',
'psutil < 7',
'retry < 1',
Expand Down
8 changes: 5 additions & 3 deletions secator/cli_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

import psutil
import rich_click as click
from rich_click.rich_click import _get_rich_console
from rich_click.rich_help_configuration import RichHelpConfiguration
from rich_click.rich_help_formatter import RichHelpFormatter

from secator.config import CONFIG
from secator.click import CLICK_LIST
Expand Down Expand Up @@ -195,7 +196,7 @@ def register_runner(cli_endpoint, config):
@decorate_command_options(options)
@click.pass_context
def func(ctx, **opts):
console = _get_rich_console()
console = RichHelpFormatter(RichHelpConfiguration.load_from_globals)
version = opts['version']
sync = opts['sync']
ws = opts.pop('workspace')
Expand Down Expand Up @@ -297,7 +298,8 @@ def func(ctx, **opts):
if CONFIG.celery.broker_url and \
(broker_protocol == 'redis' or backend_protocol == 'redis') \
and not ADDONS_ENABLED['redis']:
_get_rich_console().print('[bold red]Missing `redis` addon: please run `secator install addons redis`[/].')
RichHelpFormatter(RichHelpConfiguration.load_from_globals).print(
'[bold red]Missing `redis` addon: please run `secator install addons redis`[/].')
sys.exit(1)

from secator.utils import debug
Expand Down
7 changes: 4 additions & 3 deletions secator/click.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from collections import OrderedDict

import rich_click as click
from rich_click.rich_click import _get_rich_console
from rich_click.rich_help_configuration import RichHelpConfiguration
from rich_click.rich_help_formatter import RichHelpFormatter
from rich_click.rich_group import RichGroup


Expand Down Expand Up @@ -31,7 +32,7 @@ def command(self, *args, **kwargs):
def decorator(f):
aliases = kwargs.pop("aliases", None)
if aliases:
max_width = _get_rich_console().width
max_width = RichHelpFormatter(RichHelpConfiguration.load_from_globals).width
aliases_str = ', '.join(f'[bold cyan]{alias}[/]' for alias in aliases)
padding = max_width // 4

Expand Down Expand Up @@ -62,7 +63,7 @@ def decorator(f):
aliases = kwargs.pop('aliases', [])
aliased_group = []
if aliases:
max_width = _get_rich_console().width
max_width = RichHelpFormatter(RichHelpConfiguration.load_from_globals).width
aliases_str = ', '.join(f'[bold cyan]{alias}[/]' for alias in aliases)
padding = max_width // 4
f.__doc__ = f.__doc__ or '\0'.ljust(padding+1)
Expand Down
0