Skip to content
Myr

Merge branch '8.1.x' of https://github.com/Rowlando13/click into trim_args_section

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

authored by unknown · committed by unknown · parents ba5b4ce, 6986b08 · Browse files · 5 files+36 added−23 removed
This commit

State

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

Diff stats

5 files+36 added−23 removed

  • other:+36 added−23 removed

5 files+36 added−23 removed

modified:docs/shell-completion.rst+1 added-1 removed
60 unmodified lines
61 Add this to ``~/.config/fish/completions/foo-bar.fish``:6263 .. code-block:: fish6465 eval (env _FOO_BAR_COMPLETE=fish_source foo-bar)65 _FOO_BAR_COMPLETE=fish_source foo-bar | source6667 This is the same file used for the activation script method68 below. For Fish it's probably always easier to use that method.69
218 unmodified lines
modified:src/click/__init__.py+1 added-1 removed
68 unmodified lines
69from .utils import get_binary_stream as get_binary_stream70from .utils import get_text_stream as get_text_stream71from .utils import open_file as open_file7273__version__ = "8.1.6"73__version__ = "8.1.7"
modified:src/click/_compat.py+1 added-1 removed
514 unmodified lines
515 return locale.getpreferredencoding()516517 _ansi_stream_wrappers: t.MutableMapping[t.TextIO, t.TextIO] = WeakKeyDictionary()518519 def auto_wrap_for_ansi(519 def auto_wrap_for_ansi( # noqa: F811520 stream: t.TextIO, color: t.Optional[bool] = None521 ) -> t.TextIO:522 """Support ANSI color and style codes on Windows by wrapping a523 stream with colorama.
100 unmodified lines
modified:src/click/shell_completion.py+23 added-20 removed
165 unmodified lines
166fi167"""168169_SOURCE_FISH = """\170function %(complete_func)s170function %(complete_func)s;171 set -l response (env %(complete_var)s=fish_complete COMP_WORDS=(commandline -cp) \172COMP_CWORD=(commandline -t) %(prog_name)s)172COMP_CWORD=(commandline -t) %(prog_name)s);173174 for completion in $response175 set -l metadata (string split "," $completion)174 for completion in $response;175 set -l metadata (string split "," $completion);176177 if test $metadata[1] = "dir"178 __fish_complete_directories $metadata[2]179 else if test $metadata[1] = "file"180 __fish_complete_path $metadata[2]181 else if test $metadata[1] = "plain"182 echo $metadata[2]183 end184 end185end177 if test $metadata[1] = "dir";178 __fish_complete_directories $metadata[2];179 else if test $metadata[1] = "file";180 __fish_complete_path $metadata[2];181 else if test $metadata[1] = "plain";182 echo $metadata[2];183 end;184 end;185end;186187complete --no-files --command %(prog_name)s --arguments \188"(%(complete_func)s)"188"(%(complete_func)s)";189"""190191192class ShellComplete:
36 unmodified lines
229 def func_name(self) -> str:230 """The name of the shell function defined by the completion231 script.232 """233 safe_name = re.sub(r"\W*", "", self.prog_name.replace("-", "_"), re.ASCII)233 safe_name = re.sub(r"\W*", "", self.prog_name.replace("-", "_"), flags=re.ASCII)234 return f"_{safe_name}_completion"235236 def source_vars(self) -> t.Dict[str, t.Any]:237 """Vars for formatting :attr:`source_template`.
62 unmodified lines
300301 name = "bash"302 source_template = _SOURCE_BASH303304 @staticmethod304 def _check_version(self) -> None:305 def _check_version() -> None:306 import subprocess307308 output = subprocess.run(309 ["bash", "-c", 'echo "${BASH_VERSION}"'], stdout=subprocess.PIPE
3 unmodified lines
313 if match is not None:314 major, minor = match.groups()315316 if major < "4" or major == "4" and minor < "4":316 raise RuntimeError(317 echo(318 _(319 "Shell completion is not supported for Bash"320 " versions older than 4.4."320 )321 ),322 err=True,323 )324 else:323 raise RuntimeError(324 _("Couldn't detect Bash version, shell completion is not supported.")325 echo(326 _("Couldn't detect Bash version, shell completion is not supported."),327 err=True,328 )329330 def source(self) -> str:331 self._check_version()
265 unmodified lines
modified:CHANGES.rst+10 added
1.. currentmodule:: click23Version 8.1.74-------------56Released 2023-08-1778- Fix issue with regex flags in shell completion. :issue:`2581`9- Bash version detection issues a warning instead of an error. :issue:`2574`10- Fix issue with completion script for Fish shell. :issue:`2567`111213Version 8.1.614-------------1516Released 2023-07-18
1090 unmodified lines