Skip to content

short_help not shown for commands #114

Open
@thomask77

Description

@thomask77

When I define commands like this

@click.command()
@click.argument('assignments', nargs=-1)
@click.pass_obj
def cmd_sp(obj, assignments):
    """Set parameters"""
    ...

The short help is not shown in the pop-up menu.

As a work-around, I modified click-repl like this:

--- a/Tests/click/third_party/click_repl/_completer.py
+++ b/Tests/click/third_party/click_repl/_completer.py
@@ -314,7 +314,17 @@ class ClickCompleter(Completer):
                             Completion(
                                 text_type(name),
                                 -len(incomplete),
-                                display_meta=getattr(command, "short_help", ""),
+
+                                # 2024-01-26, tk:
+                                #
+                                # There doesn't seem to be a short_help attribute..
+                                # use get_short_help_str() instead.
+                                #
+                                # See https://github.com/click-contrib/click-repl/issues/114
+                                #
+                                # display_meta=getattr(command, "short_help", ""),
+                                #
+                                display_meta=command.get_short_help_str(),
                             )
                         )

This makes it behave the same as the shell completion functions in click/core.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions