Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken bash shell completion #12

Merged
merged 2 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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