change log and doc fixes (#3495)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by GitHub · parents 6cb3477, 9c41f46 · Browse files · 9 files·+35 added−12 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
9 files+35 added−12 removed
- other:+35 added−12 removed
Provenance
- Commit
67921d5- Tree
141473d- Author
David Lord <davidism@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
6cb3477- Parent 2
9c41f46
9 files changed+35 added−12 removed
modified:docs/api.md+4 added
282 unmodified lines283 .. autoexception:: FileError284 ```285 286 ```{eval-rst}287+.. autoexception:: NoSuchCommand288+```289+290+```{eval-rst}291 .. autoexception:: NoSuchOption292 ```293 294 ```{eval-rst}67 unmodified linesmodified:docs/options.md+7 added-1 removed
561 unmodified lines562 ##### Arbitration rules563 564 When several options in a group resolve their values simultaneously, only one565 wins the parameter slot. The full arbitration policy (source precedence,566-explicit-beats-auto tie-break, first-declared fallback) is enumerated under566+explicit-beats-auto tie-break, last-declared fallback) is enumerated under567 [Option value resolution](#option-value-resolution).568 569 ## Option value resolution570 49 unmodified lines620 The first source that produces a value wins. Environment variables and621 `default_map` entries set to `Sentinel.UNSET` are skipped, so they fall through622 to the next source rather than supplying `UNSET` to the function.623 624+If after the four sources above no explicit value was found (or only a625+`default_map`/`default` value was) and the option declares `prompt=`, Click626+prompts the user for one. The resulting value is recorded as627+{attr}`ParameterSource.PROMPT`, which ranks above every source listed above628+for arbitration purposes (see [Slot arbitration](#slot-arbitration)).629+630 ### Slot arbitration631 632 Several options can target the same `name` to form a feature switch group. When633 they do, only one option's value reaches the function. Arbitration applies167 unmodified linesmodified:src/click/core.py+1 added-1 removed
2756 unmodified lines2757 :param help: the help string.2758 :param hidden: hide this option from help outputs.2759 :param attrs: Other command arguments described in :class:`Parameter`.2760 2761- .. versionchanged:: 8.42761+ .. versionchanged:: 8.4.02762 Non-basic ``flag_value`` types (not ``str``, ``int``, ``float``, or2763 ``bool``) are passed through unchanged instead of being stringified.2764 Previously, ``type=click.UNPROCESSED`` was required to preserve them.2765 777 unmodified linesmodified:src/click/exceptions.py+4 added-1 removed
247 unmodified lines248 return f"{self.message} {_format_possibilities(self.possibilities)}"249 250 251 class NoSuchCommand(UsageError):252- """Raised if Click attempted to handle a command that does not exist."""252+ """Raised if Click attempted to handle a command that does not exist.253 254+ .. versionadded:: 8.4.0255+ """256+257 def __init__(258 self,259 command_name: str,260 message: str | None = None,87 unmodified linesmodified:src/click/formatting.py+1 added-1 removed
51 unmodified lines52 each consecutive line.53 :param preserve_paragraphs: if this flag is set then the wrapping will54 intelligently handle paragraphs.55 56- .. versionchanged:: 8.456+ .. versionchanged:: 8.4.057 Width is measured in visible characters. ANSI escape sequences in58 ``text``, ``initial_indent``, or ``subsequent_indent`` no longer59 count toward the width budget, so styled input wraps based on what60 the user sees instead of raw byte length.255 unmodified linesmodified:src/click/shell_completion.py+1 added-1 removed
421 unmodified lines422 return args, incomplete423 424 def format_completion(self, item: CompletionItem) -> str:425 """426- .. versionchanged:: 8.4426+ .. versionchanged:: 8.4.0427 Escape newlines in value and help to fix completion errors with428 multi-line help strings.429 """430 # The fish completion script splits each response line on literal250 unmodified linesmodified:src/click/termui.py+1 added-1 removed
303 unmodified lines304 """Context manager.305 306 Yields a writable file-like object which can be used as an output pager.307 308- .. versionadded:: 8.2308+ .. versionadded:: 8.4.0309 310 :param color: controls if the pager supports ANSI colors or not. The311 default is autodetection.312 """629 unmodified linesmodified:src/click/types.py+11 added
48 unmodified lines49 type.50 - It must be able to convert a value if the ``ctx`` and ``param``51 arguments are ``None``. This can occur when converting prompt52 input.53+54+ .. versionchanged:: 8.4.055+ Now a generic abstract base class. Parameterize with the56+ converted value type (``ParamType[int]`` for an integer-returning57+ type) so that :meth:`convert` and downstream consumers carry the58+ narrowed return type.59 """60 61 is_composite: t.ClassVar[bool] = False62 arity: t.ClassVar[int] = 1206 unmodified lines269 270 :param case_sensitive: Set to false to make choices case271 insensitive. Defaults to true.272 273+ .. versionchanged:: 8.4.0274+ Now generic in the choice value type. Parameterize with the type of275+ the choice values (``Choice[HashType]`` for an enum, ``Choice[str]``276+ for plain strings) to enable type-checked consumers.277+278 .. versionchanged:: 8.2.0279 Non-``str`` ``choices`` are now supported. It can additionally be any280 iterable. Before you were not recommended to pass anything but a list or281 tuple.1028 unmodified linesmodified:CHANGES.rst+5 added-6 removed
5 unmodified lines6 Unreleased7 8 - ``get_parameter_source()`` is available during eager callbacks and type9 conversion again. :issue:`3458` :issue:`3484`10-- Zsh completion scripts parse correctly on Windows. :issue:`3277`10+- Zsh completion scripts parse correctly on Windows. :issue:`3277` :pr:`3466`11 - Shell completion of `Choice` `Enum` values produces a valid completion12 result. :issue:`3015`13 - Fix empty byte-string handling in echo. :issue:`3487`14 - Fix closed file error with `echo_via_pager`. :issue:`3449`37 unmodified lines52 instead of being stringified. Previously ``type=click.UNPROCESSED`` had53 to be set explicitly. :issue:`2012` :pr:`3363`54 - The error hint now uses :meth:`Command.get_help_option_names` to pick55 non-shadowed help option names, so ``Try '... -h'`` no longer points to a56- subcommand option that shadows ``-h``. All surviving names are shown57- (``-h/--help``). :issue:`2790` :pr:`3208`56+ subcommand option that shadows ``-h``. The longest surviving name is57+ shown (``--help`` over ``-h``) for readability. :issue:`2790` :pr:`3208`58 - Fix readline functionality on non-Windows platforms. Prompt text is now59 passed directly to readline instead of being printed separately, allowing60 proper backspace, line editing, and line wrapping behavior. :issue:`2968`61 :pr:`2969`7 unmodified lines69 - Use :class:`ValueError` message when conversion in :class:`FuncParamType` would70 fail. :issue:`3105` :pr:`3211`71 - Add ``click.get_pager_file`` for file-like access to an output72 pager. :pr:`1572` :pr:`3405`73-- :class:`~click.formatting.TextWrapper` and74- :func:`~click.formatting.wrap_text` now measure line width in visible73+- :func:`~click.formatting.wrap_text` now measures line width in visible74 characters, ignoring ANSI escape sequences. :pr:`3420`75 - Fix :meth:`HelpFormatter.write_usage` emitting only a blank line when76 called without ``args``. The usage prefix and program name are now77 written even when no arguments follow, and the trailing separator7 unmodified lines85 (default) and ``fd``. ``fd`` redirects file descriptors ``1`` and ``2``86 via :func:`os.dup2` so output that bypasses ``sys.stdout`` (stale stream87 references, C extensions, subprocesses, ``faulthandler``) is captured88 with proper isolation. :issue:`854` :issue:`2412` :issue:`2468`90- :issue:`2497` :issue:`2761` :issue:`2827` :issue:`2865`89+ :issue:`2497` :issue:`2761` :issue:`2827` :issue:`2865` :pr:`3391`90 - Revert the ``8.3.3`` change that exposed the original file descriptor91 via ``fileno()`` on the redirected ``CliRunner`` streams in the default92 capture mode. ``os.dup2(w, sys.stdout.fileno())`` calls inside a CLI no93 longer mutate the host runner's stdout, which broke Pytest's ``fd``-level1387 unmodified lines