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

short_help not shown for commands #114

Open
thomask77 opened this issue Jan 26, 2024 · 0 comments
Open

short_help not shown for commands #114

thomask77 opened this issue Jan 26, 2024 · 0 comments

Comments

@thomask77
Copy link

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.

@thomask77 thomask77 changed the title Short help not shown for commands that use doc strings short_help not shown for commands Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant