summaryrefslogtreecommitdiff
path: root/src/click/shell_completion.py
diff options
context:
space:
mode:
authorIwan Aucamp <aucampia@gmail.com>2021-02-01 00:43:14 +0100
committerDavid Lord <davidism@gmail.com>2021-02-15 15:41:56 -0800
commit5a77d69224936898e81010bb1c78fcb28e534318 (patch)
treea7c7828813539bd6b163f8e5ffd1031014bb04c0 /src/click/shell_completion.py
parentb8a33bf050ce41a398538d03dab6c8450ae76f28 (diff)
downloadclick-5a77d69224936898e81010bb1c78fcb28e534318.tar.gz
initial type checking configuration
add minimal annotations to pass checks
Diffstat (limited to 'src/click/shell_completion.py')
-rw-r--r--src/click/shell_completion.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/click/shell_completion.py b/src/click/shell_completion.py
index 9b10e25..d87e0c8 100644
--- a/src/click/shell_completion.py
+++ b/src/click/shell_completion.py
@@ -1,5 +1,6 @@
import os
import re
+import typing as t
from .core import Argument
from .core import MultiCommand
@@ -183,12 +184,12 @@ class ShellComplete:
.. versionadded:: 8.0
"""
- name = None
+ name: t.ClassVar[t.Optional[str]] = None
"""Name to register the shell as with :func:`add_completion_class`.
This is used in completion instructions (``{name}_source`` and
``{name}_complete``).
"""
- source_template = None
+ source_template: t.ClassVar[t.Optional[str]] = None
"""Completion script template formatted by :meth:`source`. This must
be provided by subclasses.
"""
@@ -312,7 +313,7 @@ class BashComplete(ShellComplete):
return args, incomplete
- def format_completion(self, item: CompletionItem):
+ def format_completion(self, item: CompletionItem) -> str:
return f"{item.type},{item.value}"
@@ -334,7 +335,7 @@ class ZshComplete(ShellComplete):
return args, incomplete
- def format_completion(self, item: CompletionItem):
+ def format_completion(self, item: CompletionItem) -> str:
return f"{item.type}\n{item.value}\n{item.help if item.help else '_'}"
@@ -356,7 +357,7 @@ class FishComplete(ShellComplete):
return args, incomplete
- def format_completion(self, item: CompletionItem):
+ def format_completion(self, item: CompletionItem) -> str:
if item.help:
return f"{item.type},{item.value}\t{item.help}"