click-extended 1.0.1__py3-none-any.whl → 1.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- click_extended/__init__.py +2 -0
- click_extended/core/decorators/context.py +56 -0
- {click_extended-1.0.1.dist-info → click_extended-1.0.2.dist-info}/METADATA +1 -1
- {click_extended-1.0.1.dist-info → click_extended-1.0.2.dist-info}/RECORD +8 -7
- {click_extended-1.0.1.dist-info → click_extended-1.0.2.dist-info}/WHEEL +0 -0
- {click_extended-1.0.1.dist-info → click_extended-1.0.2.dist-info}/licenses/AUTHORS.md +0 -0
- {click_extended-1.0.1.dist-info → click_extended-1.0.2.dist-info}/licenses/LICENSE +0 -0
- {click_extended-1.0.1.dist-info → click_extended-1.0.2.dist-info}/top_level.txt +0 -0
click_extended/__init__.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from click_extended.core.decorators.argument import argument
|
|
4
4
|
from click_extended.core.decorators.command import command
|
|
5
|
+
from click_extended.core.decorators.context import context
|
|
5
6
|
from click_extended.core.decorators.env import env
|
|
6
7
|
from click_extended.core.decorators.group import group
|
|
7
8
|
from click_extended.core.decorators.option import option
|
|
@@ -12,6 +13,7 @@ from click_extended.core.decorators.tag import tag
|
|
|
12
13
|
__all__ = [
|
|
13
14
|
"argument",
|
|
14
15
|
"command",
|
|
16
|
+
"context",
|
|
15
17
|
"env",
|
|
16
18
|
"group",
|
|
17
19
|
"option",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""`ParentNode` to inject the context into the function."""
|
|
2
|
+
|
|
3
|
+
# pylint: disable=redefined-builtin
|
|
4
|
+
# pylint: disable=redefined-outer-name
|
|
5
|
+
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from click_extended.core.nodes.parent_node import ParentNode
|
|
9
|
+
from click_extended.core.other.context import Context as Ctx
|
|
10
|
+
from click_extended.types import Decorator
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Context(ParentNode):
|
|
14
|
+
"""`ParentNode` to inject the context into the function."""
|
|
15
|
+
|
|
16
|
+
def load(self, context: Ctx, *args: Any, **kwargs: Any) -> Ctx:
|
|
17
|
+
return context
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def context(
|
|
21
|
+
name: str = "ctx",
|
|
22
|
+
param: str | None = None,
|
|
23
|
+
help: str | None = None,
|
|
24
|
+
tags: str | list[str] | None = None,
|
|
25
|
+
**kwargs: Any,
|
|
26
|
+
) -> Decorator:
|
|
27
|
+
"""
|
|
28
|
+
A `ParentNode` to inject the context into the function.
|
|
29
|
+
|
|
30
|
+
Type: `ParentNode`
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
name (str, optional):
|
|
34
|
+
Internal node name (must be snake_case). Defaults
|
|
35
|
+
to "ctx".
|
|
36
|
+
param (str, optional):
|
|
37
|
+
The parameter name to inject into the function.
|
|
38
|
+
If not provided, uses `name` (or derived name).
|
|
39
|
+
help (str, optional):
|
|
40
|
+
Help text for this parameter.
|
|
41
|
+
tags (str | list[str], optional):
|
|
42
|
+
Tag(s) to associate with this parameter for grouping.
|
|
43
|
+
**kwargs (Any):
|
|
44
|
+
Additional keyword arguments.
|
|
45
|
+
|
|
46
|
+
Returns:
|
|
47
|
+
Callable:
|
|
48
|
+
A decorator function that registers the context parent node.
|
|
49
|
+
"""
|
|
50
|
+
return Context.as_decorator(
|
|
51
|
+
name=name,
|
|
52
|
+
param=param,
|
|
53
|
+
help=help,
|
|
54
|
+
tags=tags,
|
|
55
|
+
**kwargs,
|
|
56
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: click_extended
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: An extension to Click with additional features like automatic async support, aliasing and a modular decorator system.
|
|
5
5
|
Author-email: Marcus Fredriksson <marcus@marcusfredriksson.com>
|
|
6
6
|
License: MIT License
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
click_extended/__init__.py,sha256=
|
|
1
|
+
click_extended/__init__.py,sha256=mF6rVnQnG-IiMSo-hX16ZzgSv8F-F3BoAyX5PDx6x90,714
|
|
2
2
|
click_extended/classes.py,sha256=SdwglQ7O5ahjYeVnaM9_hCU14BYZBv8C0ZjWQIo7A_I,837
|
|
3
3
|
click_extended/errors.py,sha256=tkvAXs4oUZ8SFgX37KhYrHAlsxmOGrSFLIezCH9NDQI,13897
|
|
4
4
|
click_extended/types.py,sha256=0YT4QN269H-01RVxDGSpMT_hJm8cTcONonpX4_YxJlg,238
|
|
@@ -6,6 +6,7 @@ click_extended/core/__init__.py,sha256=oTJS5M1OAwRQ57aMcWV7v2D2kHjCn8zTOpPEIRpTL
|
|
|
6
6
|
click_extended/core/decorators/__init__.py,sha256=AxqTVsGJcCG5d60RzffSh4cqA4U_okaMl3hlObqMOy4,656
|
|
7
7
|
click_extended/core/decorators/argument.py,sha256=MzkMkkayR7XeNNtbHstj1PpFnrCD-VCFAE3SnpO7OMY,7201
|
|
8
8
|
click_extended/core/decorators/command.py,sha256=82rwi8PIMGgOagFoNISOQkdEebKxvS9A_RHV80shUzI,2803
|
|
9
|
+
click_extended/core/decorators/context.py,sha256=y_jzARNNdu2JyUhIaUFpCAurztOTsYJTX96HQ2csZs0,1546
|
|
9
10
|
click_extended/core/decorators/env.py,sha256=DgbQsOZ2De-Ur5hxR8hzN3-3T16K3FLsoZHS2EsKK6c,4777
|
|
10
11
|
click_extended/core/decorators/group.py,sha256=_bammCVi_7vsw7YgSUTQuQp6XFUHy7knNcOmyg6DiPc,2859
|
|
11
12
|
click_extended/core/decorators/option.py,sha256=E7NzM7dNtICh9YcAvYPvJkdvuxKDNjCIFl9a8ZyhXWQ,11810
|
|
@@ -141,9 +142,9 @@ click_extended/utils/naming.py,sha256=kNmzOqidgZZ1dE5aMYrxpWt4VwcLuEiFunpumpfHuZ
|
|
|
141
142
|
click_extended/utils/process.py,sha256=sU3ZCMjBgjKcDnTRLKPdQ_TAjk0AT7Q8SatagD0JyHA,9729
|
|
142
143
|
click_extended/utils/selection.py,sha256=_OQC88pGPUh29boxmS5ugXEi9jZGqAG180S27PeQaj0,9875
|
|
143
144
|
click_extended/utils/time.py,sha256=H5m5caIEau_1GHkiYgKL_LcTtVdw2TkFVbkqJu7A9rQ,1067
|
|
144
|
-
click_extended-1.0.
|
|
145
|
-
click_extended-1.0.
|
|
146
|
-
click_extended-1.0.
|
|
147
|
-
click_extended-1.0.
|
|
148
|
-
click_extended-1.0.
|
|
149
|
-
click_extended-1.0.
|
|
145
|
+
click_extended-1.0.2.dist-info/licenses/AUTHORS.md,sha256=NkShPinjqtnRDQVRyVnfJuOGM56sejauE3WRoYCcbtw,132
|
|
146
|
+
click_extended-1.0.2.dist-info/licenses/LICENSE,sha256=gjO8hzM4mFSBXFikktaXVSgmXGcre91_GPJ-E_yP56E,1075
|
|
147
|
+
click_extended-1.0.2.dist-info/METADATA,sha256=LoKIzHzO5csaGIpPD68v1R800kVlUM7ai_ACXolUxzs,10762
|
|
148
|
+
click_extended-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
149
|
+
click_extended-1.0.2.dist-info/top_level.txt,sha256=2G3bm6tCNv80okRm773jKTk-_z1ElY-seaozZrn_TxA,15
|
|
150
|
+
click_extended-1.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|