Skip to content

Commit

Permalink
♻️ Refactor compat logic, remove support for Click 7
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo committed Mar 24, 2024
1 parent 6619036 commit b8130e2
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 301 deletions.
5 changes: 0 additions & 5 deletions typer/_compat_utils.py

This file was deleted.

File renamed without changes.
157 changes: 0 additions & 157 deletions typer/_completion_click7.py

This file was deleted.

3 changes: 0 additions & 3 deletions typer/_completion_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
shellingham = None


from typing import Optional


class Shells(str, Enum):
bash = "bash"
zsh = "zsh"
Expand Down
13 changes: 1 addition & 12 deletions typer/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import click

from ._compat_utils import _get_click_major
from ._completion_classes import completion_init
from ._completion_shared import Shells, get_completion_script, install
from .models import ParamMeta
from .params import Option
Expand Down Expand Up @@ -102,17 +102,6 @@ def _install_completion_no_auto_placeholder_function(
pass # pragma no cover


def completion_init() -> None:
if _get_click_major() < 8:
from ._completion_click7 import completion_init

completion_init()
else:
from ._completion_click8 import completion_init

completion_init()


# Re-implement Click's shell_complete to add error message with:
# Invalid completion instruction
# To use 7.x instruction style for compatibility
Expand Down
Loading

0 comments on commit b8130e2

Please sign in to comment.