You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Click, get_help calls the format_help method with a formatter that is expected to hold a buffer of the text that should be returned from the method as a string. Since rich_click does not write the terminal output to the buffer, but directly to the console, it breaks callers of get_help that expect to receive the console output.
defget_help(self, ctx: Context) ->str:
"""Formats the help into a string and returns it. Calls :meth:`format_help` internally. """formatter=ctx.make_formatter()
self.format_help(ctx, formatter)
returnformatter.getvalue().rstrip("\n")
This may not be a problem for rich_click to solve, as I'm not sure the formatter interface would support all of the capabilities of Rich. But, it would be great if the API of Click could be maintained.
Is this a problem that can be fixed by the following:
Pass a string buffer to Rich Console that writes help output.
Create a stub formatter implementing the getvalue method that returns the string buffer, or, override the get_help method to call format_help without the formatter and return the string buffer directly from Rich.
In Click,
get_help
calls theformat_help
method with aformatter
that is expected to hold a buffer of the text that should be returned from the method as a string. Sincerich_click
does not write the terminal output to the buffer, but directly to the console, it breaks callers ofget_help
that expect to receive the console output.This may not be a problem for
rich_click
to solve, as I'm not sure the formatter interface would support all of the capabilities ofRich
. But, it would be great if the API ofClick
could be maintained.Is this a problem that can be fixed by the following:
getvalue
method that returns the string buffer, or, override theget_help
method to callformat_help
without theformatter
and return the string buffer directly from Rich.Rich Reference:
The text was updated successfully, but these errors were encountered: