Skip to content
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

fix: pass cmd_len arg to avoid error thrown by safety auth --help #516

Closed
Closed
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
12 changes: 12 additions & 0 deletions safety/cli_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,24 @@ def pretty_format_help(obj: Union[click.Command, click.Group],
)
panel_to_commands[panel_name].append(command)

# Identify the longest command name in all panels
max_cmd_len = max(
[
len(command.name or "")
for commands in panel_to_commands.values()
for command in commands
],
default=0,
)

# Print each command group panel
default_commands = panel_to_commands.get(COMMANDS_PANEL_TITLE, [])
_print_commands_panel(
name=COMMANDS_PANEL_TITLE,
commands=default_commands,
markup_mode=markup_mode,
console=console,
cmd_len=max_cmd_len,
)
for panel_name, commands in panel_to_commands.items():
if panel_name == COMMANDS_PANEL_TITLE:
Expand All @@ -118,6 +129,7 @@ def pretty_format_help(obj: Union[click.Command, click.Group],
commands=commands,
markup_mode=markup_mode,
console=console,
cmd_len=max_cmd_len,
)

panel_to_arguments: DefaultDict[str, List[click.Argument]] = defaultdict(list)
Expand Down