click-extended 0.3.1__tar.gz → 0.4.0__tar.gz
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-0.4.0/PKG-INFO +261 -0
- click_extended-0.4.0/README.md +198 -0
- click_extended-0.4.0/click_extended/__init__.py +17 -0
- click_extended-0.4.0/click_extended/classes.py +21 -0
- click_extended-0.4.0/click_extended/errors.py +450 -0
- click_extended-0.4.0/click_extended/types.py +12 -0
- click_extended-0.4.0/click_extended.egg-info/PKG-INFO +261 -0
- {click_extended-0.3.1 → click_extended-0.4.0}/click_extended.egg-info/SOURCES.txt +7 -6
- {click_extended-0.3.1 → click_extended-0.4.0}/pyproject.toml +14 -3
- click_extended-0.4.0/tests/test_argument_node.py +1059 -0
- click_extended-0.4.0/tests/test_child_node.py +2633 -0
- click_extended-0.4.0/tests/test_context.py +867 -0
- click_extended-0.4.0/tests/test_errors.py +478 -0
- click_extended-0.4.0/tests/test_lifecycle.py +188 -0
- click_extended-0.4.0/tests/test_node.py +112 -0
- click_extended-0.4.0/tests/test_option_node.py +1346 -0
- click_extended-0.4.0/tests/test_parent_node.py +947 -0
- click_extended-0.4.0/tests/test_root_node.py +2240 -0
- click_extended-0.4.0/tests/test_tag.py +766 -0
- click_extended-0.4.0/tests/test_tree.py +1481 -0
- click_extended-0.3.1/PKG-INFO +0 -257
- click_extended-0.3.1/README.md +0 -194
- click_extended-0.3.1/click_extended/__init__.py +0 -30
- click_extended-0.3.1/click_extended/errors.py +0 -334
- click_extended-0.3.1/click_extended/types.py +0 -33
- click_extended-0.3.1/click_extended.egg-info/PKG-INFO +0 -257
- click_extended-0.3.1/tests/test_argument.py +0 -915
- click_extended-0.3.1/tests/test_child_node.py +0 -919
- click_extended-0.3.1/tests/test_command.py +0 -701
- click_extended-0.3.1/tests/test_env.py +0 -887
- click_extended-0.3.1/tests/test_global_node.py +0 -749
- click_extended-0.3.1/tests/test_group.py +0 -912
- click_extended-0.3.1/tests/test_option.py +0 -904
- click_extended-0.3.1/tests/test_parent_node.py +0 -620
- click_extended-0.3.1/tests/test_root_node.py +0 -558
- click_extended-0.3.1/tests/test_tag.py +0 -599
- click_extended-0.3.1/tests/test_tree.py +0 -778
- {click_extended-0.3.1 → click_extended-0.4.0}/AUTHORS.md +0 -0
- {click_extended-0.3.1 → click_extended-0.4.0}/LICENSE +0 -0
- {click_extended-0.3.1 → click_extended-0.4.0}/click_extended.egg-info/dependency_links.txt +0 -0
- {click_extended-0.3.1 → click_extended-0.4.0}/click_extended.egg-info/requires.txt +0 -0
- {click_extended-0.3.1 → click_extended-0.4.0}/click_extended.egg-info/top_level.txt +0 -0
- {click_extended-0.3.1 → click_extended-0.4.0}/setup.cfg +0 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: click_extended
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: An extension to Click with additional features like automatic async support, aliasing and a modular decorator system.
|
|
5
|
+
Author-email: Marcus Fredriksson <marcus@marcusfredriksson.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Marcus Fredriksson
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/marcusfrdk/click-extended
|
|
29
|
+
Project-URL: Repository, https://github.com/marcusfrdk/click-extended
|
|
30
|
+
Project-URL: Issues, https://github.com/marcusfrdk/click-extended/issues
|
|
31
|
+
Keywords: click,cli,command-line,alias,aliasing,command,group,decorator,terminal,console
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
34
|
+
Classifier: Operating System :: OS Independent
|
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
40
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
41
|
+
Classifier: Topic :: System :: Shells
|
|
42
|
+
Classifier: Topic :: Utilities
|
|
43
|
+
Classifier: Typing :: Typed
|
|
44
|
+
Requires-Python: >=3.10
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
License-File: LICENSE
|
|
47
|
+
License-File: AUTHORS.md
|
|
48
|
+
Requires-Dist: click>=8.3.0
|
|
49
|
+
Requires-Dist: python-dotenv>=1.2.1
|
|
50
|
+
Provides-Extra: build
|
|
51
|
+
Requires-Dist: build; extra == "build"
|
|
52
|
+
Requires-Dist: twine; extra == "build"
|
|
53
|
+
Provides-Extra: dev
|
|
54
|
+
Requires-Dist: pytest>=8.4.2; extra == "dev"
|
|
55
|
+
Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
|
|
56
|
+
Requires-Dist: pytest-asyncio>=1.2.0; extra == "dev"
|
|
57
|
+
Requires-Dist: mypy>=1.18.2; extra == "dev"
|
|
58
|
+
Requires-Dist: pylint>=3.0.0; extra == "dev"
|
|
59
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
60
|
+
Requires-Dist: black>=25.9.0; extra == "dev"
|
|
61
|
+
Requires-Dist: pre-commit>=4.3.0; extra == "dev"
|
|
62
|
+
Dynamic: license-file
|
|
63
|
+
|
|
64
|
+

|
|
65
|
+
|
|
66
|
+
# Click Extended
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+

|
|
70
|
+

|
|
71
|
+

|
|
72
|
+

|
|
73
|
+

|
|
74
|
+

|
|
75
|
+

|
|
76
|
+

|
|
77
|
+

|
|
78
|
+

|
|
79
|
+
|
|
80
|
+
An extension of the [Click](https://github.com/pallets/click) library with additional features like aliasing, asynchronous support, an extended decorator API and more.
|
|
81
|
+
|
|
82
|
+
## Features
|
|
83
|
+
|
|
84
|
+
- **Decorator API**: Extend the functionality your command line by adding custom data sources, data processing pipelines, and more.
|
|
85
|
+
- **Aliasing**: Use aliases for groups and commands to reduce boilerplate and code repetition.
|
|
86
|
+
- **Tags**: Use tags to group several data sources together to apply batch processing.
|
|
87
|
+
- **Async Support**: Native support for declaring functions and methods asynchronous.
|
|
88
|
+
- **Environment Variables**: Built-in support for loading and using environment variables as a data source.
|
|
89
|
+
- **Full Type Support**: Built with type-hinting from the ground up, meaning everything is fully typed.
|
|
90
|
+
- **Improved Errors**: Improved error output like tips, debugging, and more.
|
|
91
|
+
|
|
92
|
+
## Installation
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pip install click-extended
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Requirements
|
|
99
|
+
|
|
100
|
+
- **Python**: 3.10 or higher
|
|
101
|
+
|
|
102
|
+
## Quick Start
|
|
103
|
+
|
|
104
|
+
### Basic Command
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from click_extended import command, argument, option
|
|
108
|
+
|
|
109
|
+
@command(aliases="ping")
|
|
110
|
+
@argument("value")
|
|
111
|
+
@option("--count", "-c", default=1)
|
|
112
|
+
def my_function(value: str, count: int):
|
|
113
|
+
"""This is the help message for my_function."""
|
|
114
|
+
if _ in range(count):
|
|
115
|
+
print(value)
|
|
116
|
+
|
|
117
|
+
if __name__ == "__main__":
|
|
118
|
+
my_function()
|
|
119
|
+
|
|
120
|
+
# $ python cli.py "Hello world"
|
|
121
|
+
# Hello world
|
|
122
|
+
|
|
123
|
+
# $ python cli.py "Hello world" --count 3
|
|
124
|
+
# Hello world
|
|
125
|
+
# Hello world
|
|
126
|
+
# Hello world
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Basic Command Line Interface
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
from click_extended import group, argument, option
|
|
133
|
+
|
|
134
|
+
@group()
|
|
135
|
+
def my_group():
|
|
136
|
+
"""This is the help message for my_group."""
|
|
137
|
+
print("Running initialization code...")
|
|
138
|
+
|
|
139
|
+
@my_group.command(aliases=["ping", "repeat"])
|
|
140
|
+
@argument("value")
|
|
141
|
+
@option("--count", "-c", default=1)
|
|
142
|
+
def my_function(value: str, count: int):
|
|
143
|
+
"""This is the help message for my_function."""
|
|
144
|
+
if _ in range(count):
|
|
145
|
+
print(value)
|
|
146
|
+
|
|
147
|
+
if __name__ == "__main__":
|
|
148
|
+
my_group()
|
|
149
|
+
|
|
150
|
+
# $ python cli.py my_function "Hello world"
|
|
151
|
+
# Running initialization code...
|
|
152
|
+
# Hello world
|
|
153
|
+
|
|
154
|
+
# $ python cli.py my_function "Hello world" --count 3
|
|
155
|
+
# Running initialization code...
|
|
156
|
+
# Hello world
|
|
157
|
+
# Hello world
|
|
158
|
+
# Hello world
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Using Environment Variables
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
from click_extended import group, command, env
|
|
165
|
+
|
|
166
|
+
@group()
|
|
167
|
+
def my_group():
|
|
168
|
+
"""This is the help message for my_group."""
|
|
169
|
+
|
|
170
|
+
@my_group.command()
|
|
171
|
+
@env("API_KEY")
|
|
172
|
+
def my_function_1(api_key: str | None):
|
|
173
|
+
"""This is the help message for my_function."""
|
|
174
|
+
print(f"The API key is: {api_key}")
|
|
175
|
+
|
|
176
|
+
@my_group.command()
|
|
177
|
+
@env("API_KEY", required=True)
|
|
178
|
+
def my_function_2(api_key: str):
|
|
179
|
+
"""This is the help message for my_function."""
|
|
180
|
+
print(f"The API key is: {api_key}")
|
|
181
|
+
|
|
182
|
+
if __name__ == "__main__":
|
|
183
|
+
my_group()
|
|
184
|
+
|
|
185
|
+
# $ python cli.py my_function_1
|
|
186
|
+
# The API key is: None
|
|
187
|
+
|
|
188
|
+
# $ API_KEY=api-key python cli.py my_function_1
|
|
189
|
+
# The API key is: api-key
|
|
190
|
+
|
|
191
|
+
# $ python cli.py my_function_2
|
|
192
|
+
# ProcessError (my_function_2): Required environment variable 'API_KEY' is not set.
|
|
193
|
+
|
|
194
|
+
# $ API_KEY=api-key python cli.py my_function_2
|
|
195
|
+
# The API key is: api-key
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Custom Children
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
from typing import Any
|
|
202
|
+
|
|
203
|
+
from click_extended import group, argument, option
|
|
204
|
+
from click_extended.classes import ChildNode
|
|
205
|
+
from click_extended.types import Context, Decorator
|
|
206
|
+
|
|
207
|
+
class MyCustomChild(ChildNode):
|
|
208
|
+
def handle_primitive(
|
|
209
|
+
self,
|
|
210
|
+
value: str,
|
|
211
|
+
context: Context,
|
|
212
|
+
*args: Any,
|
|
213
|
+
**kwargs: Any,
|
|
214
|
+
) -> str:
|
|
215
|
+
if value == "invalid":
|
|
216
|
+
raise ValueError("The value 'invalid' is not valid")
|
|
217
|
+
|
|
218
|
+
return value.upper()
|
|
219
|
+
|
|
220
|
+
def my_custom_child() -> Decorator:
|
|
221
|
+
"""Checks if the value is invalid and converts it to uppercase."""
|
|
222
|
+
return MyCustomChild.as_decorator()
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
@group()
|
|
226
|
+
def my_group():
|
|
227
|
+
"""This is the help message for my_group."""
|
|
228
|
+
print("Running initialization code...")
|
|
229
|
+
|
|
230
|
+
@my_group.command(aliases=["ping", "repeat"])
|
|
231
|
+
@argument("value")
|
|
232
|
+
@my_custom_child()
|
|
233
|
+
def my_function(value: str):
|
|
234
|
+
"""This is the help message for my_function."""
|
|
235
|
+
print(f"The value '{value}' should be uppercase.")
|
|
236
|
+
|
|
237
|
+
if __name__ == "__main__":
|
|
238
|
+
my_group()
|
|
239
|
+
|
|
240
|
+
# $ python cli.py my_function valid
|
|
241
|
+
# The value 'VALID' should be uppercase.
|
|
242
|
+
|
|
243
|
+
# $ python cli.py my_function invalid
|
|
244
|
+
# ValueError (my_function): "The value 'invalid' is not valid"
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Documentation
|
|
248
|
+
|
|
249
|
+
The full documentation is [available here](./docs/README.md) and goes through the full library, from explaining design choices, how to use the library, and much more.
|
|
250
|
+
|
|
251
|
+
## Contributing
|
|
252
|
+
|
|
253
|
+
Contributors are more than welcome to work on this project. Read the [contribution documentation](./CONTRIBUTING.md) to learn more.
|
|
254
|
+
|
|
255
|
+
## License
|
|
256
|
+
|
|
257
|
+
This project is licensed under the MIT License, see the [license file](./LICENSE) for details.
|
|
258
|
+
|
|
259
|
+
## Acknowledgements
|
|
260
|
+
|
|
261
|
+
This project is built on top of the [Click](https://github.com/pallets/click) library.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Click Extended
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+

|
|
13
|
+

|
|
14
|
+

|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
An extension of the [Click](https://github.com/pallets/click) library with additional features like aliasing, asynchronous support, an extended decorator API and more.
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- **Decorator API**: Extend the functionality your command line by adding custom data sources, data processing pipelines, and more.
|
|
22
|
+
- **Aliasing**: Use aliases for groups and commands to reduce boilerplate and code repetition.
|
|
23
|
+
- **Tags**: Use tags to group several data sources together to apply batch processing.
|
|
24
|
+
- **Async Support**: Native support for declaring functions and methods asynchronous.
|
|
25
|
+
- **Environment Variables**: Built-in support for loading and using environment variables as a data source.
|
|
26
|
+
- **Full Type Support**: Built with type-hinting from the ground up, meaning everything is fully typed.
|
|
27
|
+
- **Improved Errors**: Improved error output like tips, debugging, and more.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install click-extended
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
|
|
37
|
+
- **Python**: 3.10 or higher
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
### Basic Command
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from click_extended import command, argument, option
|
|
45
|
+
|
|
46
|
+
@command(aliases="ping")
|
|
47
|
+
@argument("value")
|
|
48
|
+
@option("--count", "-c", default=1)
|
|
49
|
+
def my_function(value: str, count: int):
|
|
50
|
+
"""This is the help message for my_function."""
|
|
51
|
+
if _ in range(count):
|
|
52
|
+
print(value)
|
|
53
|
+
|
|
54
|
+
if __name__ == "__main__":
|
|
55
|
+
my_function()
|
|
56
|
+
|
|
57
|
+
# $ python cli.py "Hello world"
|
|
58
|
+
# Hello world
|
|
59
|
+
|
|
60
|
+
# $ python cli.py "Hello world" --count 3
|
|
61
|
+
# Hello world
|
|
62
|
+
# Hello world
|
|
63
|
+
# Hello world
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Basic Command Line Interface
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from click_extended import group, argument, option
|
|
70
|
+
|
|
71
|
+
@group()
|
|
72
|
+
def my_group():
|
|
73
|
+
"""This is the help message for my_group."""
|
|
74
|
+
print("Running initialization code...")
|
|
75
|
+
|
|
76
|
+
@my_group.command(aliases=["ping", "repeat"])
|
|
77
|
+
@argument("value")
|
|
78
|
+
@option("--count", "-c", default=1)
|
|
79
|
+
def my_function(value: str, count: int):
|
|
80
|
+
"""This is the help message for my_function."""
|
|
81
|
+
if _ in range(count):
|
|
82
|
+
print(value)
|
|
83
|
+
|
|
84
|
+
if __name__ == "__main__":
|
|
85
|
+
my_group()
|
|
86
|
+
|
|
87
|
+
# $ python cli.py my_function "Hello world"
|
|
88
|
+
# Running initialization code...
|
|
89
|
+
# Hello world
|
|
90
|
+
|
|
91
|
+
# $ python cli.py my_function "Hello world" --count 3
|
|
92
|
+
# Running initialization code...
|
|
93
|
+
# Hello world
|
|
94
|
+
# Hello world
|
|
95
|
+
# Hello world
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Using Environment Variables
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from click_extended import group, command, env
|
|
102
|
+
|
|
103
|
+
@group()
|
|
104
|
+
def my_group():
|
|
105
|
+
"""This is the help message for my_group."""
|
|
106
|
+
|
|
107
|
+
@my_group.command()
|
|
108
|
+
@env("API_KEY")
|
|
109
|
+
def my_function_1(api_key: str | None):
|
|
110
|
+
"""This is the help message for my_function."""
|
|
111
|
+
print(f"The API key is: {api_key}")
|
|
112
|
+
|
|
113
|
+
@my_group.command()
|
|
114
|
+
@env("API_KEY", required=True)
|
|
115
|
+
def my_function_2(api_key: str):
|
|
116
|
+
"""This is the help message for my_function."""
|
|
117
|
+
print(f"The API key is: {api_key}")
|
|
118
|
+
|
|
119
|
+
if __name__ == "__main__":
|
|
120
|
+
my_group()
|
|
121
|
+
|
|
122
|
+
# $ python cli.py my_function_1
|
|
123
|
+
# The API key is: None
|
|
124
|
+
|
|
125
|
+
# $ API_KEY=api-key python cli.py my_function_1
|
|
126
|
+
# The API key is: api-key
|
|
127
|
+
|
|
128
|
+
# $ python cli.py my_function_2
|
|
129
|
+
# ProcessError (my_function_2): Required environment variable 'API_KEY' is not set.
|
|
130
|
+
|
|
131
|
+
# $ API_KEY=api-key python cli.py my_function_2
|
|
132
|
+
# The API key is: api-key
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Custom Children
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
from typing import Any
|
|
139
|
+
|
|
140
|
+
from click_extended import group, argument, option
|
|
141
|
+
from click_extended.classes import ChildNode
|
|
142
|
+
from click_extended.types import Context, Decorator
|
|
143
|
+
|
|
144
|
+
class MyCustomChild(ChildNode):
|
|
145
|
+
def handle_primitive(
|
|
146
|
+
self,
|
|
147
|
+
value: str,
|
|
148
|
+
context: Context,
|
|
149
|
+
*args: Any,
|
|
150
|
+
**kwargs: Any,
|
|
151
|
+
) -> str:
|
|
152
|
+
if value == "invalid":
|
|
153
|
+
raise ValueError("The value 'invalid' is not valid")
|
|
154
|
+
|
|
155
|
+
return value.upper()
|
|
156
|
+
|
|
157
|
+
def my_custom_child() -> Decorator:
|
|
158
|
+
"""Checks if the value is invalid and converts it to uppercase."""
|
|
159
|
+
return MyCustomChild.as_decorator()
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
@group()
|
|
163
|
+
def my_group():
|
|
164
|
+
"""This is the help message for my_group."""
|
|
165
|
+
print("Running initialization code...")
|
|
166
|
+
|
|
167
|
+
@my_group.command(aliases=["ping", "repeat"])
|
|
168
|
+
@argument("value")
|
|
169
|
+
@my_custom_child()
|
|
170
|
+
def my_function(value: str):
|
|
171
|
+
"""This is the help message for my_function."""
|
|
172
|
+
print(f"The value '{value}' should be uppercase.")
|
|
173
|
+
|
|
174
|
+
if __name__ == "__main__":
|
|
175
|
+
my_group()
|
|
176
|
+
|
|
177
|
+
# $ python cli.py my_function valid
|
|
178
|
+
# The value 'VALID' should be uppercase.
|
|
179
|
+
|
|
180
|
+
# $ python cli.py my_function invalid
|
|
181
|
+
# ValueError (my_function): "The value 'invalid' is not valid"
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Documentation
|
|
185
|
+
|
|
186
|
+
The full documentation is [available here](./docs/README.md) and goes through the full library, from explaining design choices, how to use the library, and much more.
|
|
187
|
+
|
|
188
|
+
## Contributing
|
|
189
|
+
|
|
190
|
+
Contributors are more than welcome to work on this project. Read the [contribution documentation](./CONTRIBUTING.md) to learn more.
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
This project is licensed under the MIT License, see the [license file](./LICENSE) for details.
|
|
195
|
+
|
|
196
|
+
## Acknowledgements
|
|
197
|
+
|
|
198
|
+
This project is built on top of the [Click](https://github.com/pallets/click) library.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Initialization file for the 'click_extended' module."""
|
|
2
|
+
|
|
3
|
+
from click_extended.core.argument import argument
|
|
4
|
+
from click_extended.core.command import command
|
|
5
|
+
from click_extended.core.env import env
|
|
6
|
+
from click_extended.core.group import group
|
|
7
|
+
from click_extended.core.option import option
|
|
8
|
+
from click_extended.core.tag import tag
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"argument",
|
|
12
|
+
"command",
|
|
13
|
+
"env",
|
|
14
|
+
"group",
|
|
15
|
+
"option",
|
|
16
|
+
"tag",
|
|
17
|
+
]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Classes used in `click_extended`."""
|
|
2
|
+
|
|
3
|
+
from click_extended.core.argument_node import ArgumentNode
|
|
4
|
+
from click_extended.core.child_node import ChildNode
|
|
5
|
+
from click_extended.core.command import Command
|
|
6
|
+
from click_extended.core.group import Group
|
|
7
|
+
from click_extended.core.node import Node
|
|
8
|
+
from click_extended.core.option_node import OptionNode
|
|
9
|
+
from click_extended.core.parent_node import ParentNode
|
|
10
|
+
from click_extended.core.tag import Tag
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"Node",
|
|
14
|
+
"ChildNode",
|
|
15
|
+
"ParentNode",
|
|
16
|
+
"ArgumentNode",
|
|
17
|
+
"OptionNode",
|
|
18
|
+
"Command",
|
|
19
|
+
"Group",
|
|
20
|
+
"Tag",
|
|
21
|
+
]
|