Skip to content

Commit

Permalink
Fix broken bash shell completion (#12)
Browse files Browse the repository at this point in the history
* Update the minimum Click version from `8.1.3` to `8.1.7`

* Remove patch for Click Bash completion

Introduced in #11. See #10.
  • Loading branch information
superatomic authored Aug 18, 2023
1 parent af9d673 commit a9662e1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 18 deletions.
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ include = ["generate_completions.sh", "tldr-man.1"]

[tool.poetry.dependencies]
python = "^3.10.4"
click = "^8.1.3"
click = "^8.1.7"
click-help-colors = "^0.9.1"
requests = "^2.28.1"

Expand Down
5 changes: 1 addition & 4 deletions src/tldr_man/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,12 @@
from click_help_colors import HelpColorsCommand

from tldr_man import pages
from tldr_man.shell_completion import page_shell_complete, language_shell_complete, patch_bash_completion
from tldr_man.shell_completion import page_shell_complete, language_shell_complete
from tldr_man.languages import get_locales
from tldr_man.platforms import get_page_sections, TLDR_PLATFORMS
from tldr_man.util import unique, mkstemp_path


patch_bash_completion() # See issue #10


def standalone_subcommand(func):
"""Function decorator to reduce boilerplate code at the start and end of all subcommand callback functions."""
@wraps(func)
Expand Down
9 changes: 0 additions & 9 deletions src/tldr_man/shell_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,3 @@ def language_shell_complete(_ctx: Context, _param: Parameter, _incomplete: str)
if not CACHE_DIR.exists():
return []
return [CompletionItem(code) for code in all_language_codes()]


def patch_bash_completion():
"""
Patches click Bash shell completion generation to not raise an error on generating for Bash versions older than 4.4.
Fixes <https://github.com/superatomic/tldr-man/issues/10>, <https://github.com/pallets/click/issues/2574>.
"""
BashComplete._check_version = lambda _: None

0 comments on commit a9662e1

Please sign in to comment.