Skip to content
Myr

Option calls cleandoc on help instead of @option

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

authored by Gianluca Gippetto · committed by David Lord · parent c9c406b · Browse files · 3 files+9 added−3 removed
This commit

State

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

Diff stats

3 files+9 added−3 removed

  • other:+9 added−3 removed

3 files+9 added−3 removed

modified:src/click/core.py+7 added
2414 unmodified lines
2415 :param help: the help string.2416 :param hidden: hide this option from help outputs.24172418 .. versionchanged:: 8.1.02419 Help text indentation is cleaned here instead of only in the2420 ``@option`` decorator.24212422 .. versionchanged:: 8.1.02423 The ``show_default`` parameter overrides2424 ``Context.show_default``.24252426 .. versionchanged:: 8.1.0
25 unmodified lines
2452 show_choices: bool = True,2453 show_envvar: bool = False,2454 **attrs: t.Any,2455 ) -> None:2456 if help:2457 help = inspect.cleandoc(help)24582459 default_is_missing = "default" not in attrs2460 super().__init__(param_decls, type=type, multiple=multiple, **attrs)24612462 if prompt is True:
495 unmodified lines
modified:src/click/decorators.py-3 removed
295 unmodified lines
296297 def decorator(f: FC) -> FC:298 # Issue 926, copy attrs, so pre-defined options can re-use the same cls=299 option_attrs = attrs.copy()300301 if option_attrs.get("help"):302 option_attrs["help"] = inspect.cleandoc(option_attrs["help"])300 OptionClass = option_attrs.pop("cls", None) or Option301 _param_memo(f, OptionClass(param_decls, **option_attrs))302 return f303
187 unmodified lines
modified:CHANGES.rst+2 added
25 unmodified lines
26 of the other way around. :issue:`1963`27- Parameter decorators and ``@group`` handles ``cls=None`` the same as28 not passing ``cls``. ``@option`` handles ``help=None`` the same as29 not passing ``help``. :issue:`#1959`30- Help text passed to ``Option`` is processed the same way as using31 the ``@option`` decorator. :issue:`1985`323334Version 8.0.435-------------
948 unmodified lines