Skip to content
Myr

add Context.formatter_class

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent ca4e4d9 · Browse files · 2 files+20 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+20 added−2 removed

  • other:+20 added−2 removed

2 files+20 added−2 removed

modified:src/click/core.py+15 added-2 removed
243 unmodified lines
244 Even if an option is later created with show_default=False,245 this command-level setting overrides it.246 """247248 #: The formatter class to create with :meth:`make_formatter`.249 #:250 #: .. versionadded:: 8.0251 formatter_class = HelpFormatter252253 def __init__(254 self,255 command,256 parent=None,
222 unmodified lines
479 """480 return self._meta481482 def make_formatter(self):478 """Creates the formatter for the help and usage output."""479 return HelpFormatter(483 """Creates the :class:`~click.HelpFormatter` for the help and484 usage output.485486 To quickly customize the formatter class used without overriding487 this method, set the :attr:`formatter_class` attribute.488489 .. versionchanged:: 8.0490 Added the :attr:`formatter_class` attribute.491 """492 return self.formatter_class(493 width=self.terminal_width, max_width=self.max_content_width494 )495496 def call_on_close(self, f):
1633 unmodified lines
modified:CHANGES.rst+5 added
41 unmodified lines
42- Non-string objects passed to ``style()`` and ``secho()`` will be43 converted to string. :pr:`1146`44- ``edit(require_save=True)`` will detect saves for editors that exit45 very fast on filesystems with 1 second resolution. :pr:`1050`46- ``Command`` has a ``context_class`` attribute to quickly customize47 the ``Context``. ``Context`` has a ``formatter_class`` attribute to48 quickly customize the ``HelpFormatter``. ``Context.invoke`` creates49 child contexts of the same type as itself. Core objects use50 ``super()`` consistently. :pr:`938`515253Version 7.1.254-------------
635 unmodified lines