click-extended 0.3.2__py3-none-any.whl → 1.0.0__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/types.py CHANGED
@@ -1,32 +1,12 @@
1
- """Types used in `click_extended` which can be useful for users."""
2
-
3
- # pylint: disable=invalid-name
1
+ """Types used in `click_extended`."""
4
2
 
5
3
  from typing import Any, Callable
6
4
 
7
- from click_extended.core._child_node import ProcessContext
8
- from click_extended.core.argument import Argument
9
- from click_extended.core.command import Command
10
- from click_extended.core.env import Env
11
- from click_extended.core.group import Group
12
- from click_extended.core.option import Option
13
- from click_extended.core.tag import Tag
5
+ from click_extended.core.other.context import Context
14
6
 
15
- Tags = dict[str, Tag]
16
- Siblings = list[str]
17
- Parent = "ParentNode | Tag"
18
7
  Decorator = Callable[[Callable[..., Any]], Callable[..., Any]]
19
8
 
20
9
  __all__ = [
21
- "ProcessContext",
10
+ "Context",
22
11
  "Decorator",
23
- "Parent",
24
- "Argument",
25
- "Command",
26
- "Env",
27
- "Group",
28
- "Option",
29
- "Siblings",
30
- "Tag",
31
- "Tags",
32
12
  ]
@@ -0,0 +1,331 @@
1
+ Metadata-Version: 2.4
2
+ Name: click_extended
3
+ Version: 1.0.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
+ Requires-Dist: pyyaml>=6.0.3
51
+ Requires-Dist: email-validator>=2.3.0
52
+ Requires-Dist: python-slugify>=8.0.4
53
+ Requires-Dist: tomli>=2.0.0; python_version < "3.11"
54
+ Provides-Extra: build
55
+ Requires-Dist: build; extra == "build"
56
+ Requires-Dist: twine; extra == "build"
57
+ Provides-Extra: dev
58
+ Requires-Dist: pytest>=8.4.2; extra == "dev"
59
+ Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
60
+ Requires-Dist: pytest-asyncio>=1.2.0; extra == "dev"
61
+ Requires-Dist: mypy>=1.18.2; extra == "dev"
62
+ Requires-Dist: pylint>=3.0.0; extra == "dev"
63
+ Requires-Dist: isort>=5.12.0; extra == "dev"
64
+ Requires-Dist: black>=25.9.0; extra == "dev"
65
+ Requires-Dist: pre-commit>=4.3.0; extra == "dev"
66
+ Requires-Dist: types-PyYAML>=6.0.12.20250915; extra == "dev"
67
+ Requires-Dist: tomli>=2.0.0; extra == "dev"
68
+ Dynamic: license-file
69
+
70
+ ![Banner](./assets/click-extended-banner.png)
71
+
72
+ # Click Extended
73
+
74
+ ![top language](https://img.shields.io/github/languages/top/marcusfrdk/click-extended)
75
+ ![code size](https://img.shields.io/github/languages/code-size/marcusfrdk/click-extended)
76
+ ![last commit](https://img.shields.io/github/last-commit/marcusfrdk/click-extended)
77
+ ![tests](https://github.com/marcusfrdk/click-extended/actions/workflows/tests.yml/badge.svg)
78
+ ![release](https://github.com/marcusfrdk/click-extended/actions/workflows/release.yml/badge.svg)
79
+ ![issues](https://img.shields.io/github/issues/marcusfrdk/click-extended)
80
+ ![contributors](https://img.shields.io/github/contributors/marcusfrdk/click-extended)
81
+ ![pypi](https://img.shields.io/pypi/v/click-extended)
82
+ ![license](https://img.shields.io/github/license/marcusfrdk/click-extended)
83
+ ![downloads](https://static.pepy.tech/badge/click-extended)
84
+ ![monthly downloads](https://static.pepy.tech/badge/click-extended/month)
85
+
86
+ An extension of the [Click](https://github.com/pallets/click) library with additional features like aliasing, asynchronous support, an extended decorator API and more.
87
+
88
+ ## Features
89
+
90
+ - **Decorator API**: Extend the functionality your command line by adding custom data sources, data processing pipelines, and more.
91
+ - **Aliasing**: Use aliases for groups and commands to reduce boilerplate and code repetition.
92
+ - **Tags**: Use tags to group several data sources together to apply batch processing.
93
+ - **Async Support**: Native support for declaring functions and methods asynchronous.
94
+ - **Environment Variables**: Built-in support for loading and using environment variables as a data source.
95
+ - **Full Type Support**: Built with type-hinting from the ground up, meaning everything is fully typed.
96
+ - **Improved Errors**: Improved error output like tips, debugging, and more.
97
+ - **Short Flag Concatenation**: Automatically support concatenating short hand flags where `-r -f` is the same as `-rf`.
98
+
99
+ ## Installation
100
+
101
+ ```bash
102
+ pip install click-extended
103
+ ```
104
+
105
+ ## Requirements
106
+
107
+ - **Python**: 3.10 or higher
108
+
109
+ ## Quick Start
110
+
111
+ ### Basic Command
112
+
113
+ ```python
114
+ from click_extended import command, argument, option
115
+
116
+ @command(aliases="ping")
117
+ @argument("value")
118
+ @option("--count", "-c", default=1)
119
+ def my_function(value: str, count: int):
120
+ """This is the help message for my_function."""
121
+ if _ in range(count):
122
+ print(value)
123
+
124
+ if __name__ == "__main__":
125
+ my_function()
126
+ ```
127
+
128
+ ```bash
129
+ $ python cli.py "Hello world"
130
+ Hello world
131
+ ```
132
+
133
+ ```bash
134
+ $ python cli.py "Hello world" --count 3
135
+ Hello world
136
+ Hello world
137
+ Hello world
138
+ ```
139
+
140
+ ### Basic Command Line Interface
141
+
142
+ ```python
143
+ from click_extended import group, argument, option
144
+
145
+ @group()
146
+ def my_group():
147
+ """This is the help message for my_group."""
148
+ print("Running initialization code...")
149
+
150
+ @my_group.command(aliases=["ping", "repeat"])
151
+ @argument("value")
152
+ @option("--count", "-c", default=1)
153
+ def my_function(value: str, count: int):
154
+ """This is the help message for my_function."""
155
+ if _ in range(count):
156
+ print(value)
157
+
158
+ if __name__ == "__main__":
159
+ my_group()
160
+ ```
161
+
162
+ ```bash
163
+ $ python cli.py my_function "Hello world"
164
+ Running initialization code...
165
+ Hello world
166
+ ```
167
+
168
+ ```bash
169
+ $ python cli.py my_function "Hello world" --count 3
170
+ Running initialization code...
171
+ Hello world
172
+ Hello world
173
+ Hello world
174
+ ```
175
+
176
+ ### Using Environment Variables
177
+
178
+ ```python
179
+ from click_extended import group, command, env
180
+
181
+ @group()
182
+ def my_group():
183
+ """This is the help message for my_group."""
184
+
185
+ @my_group.command()
186
+ @env("API_KEY")
187
+ def my_function_1(api_key: str | None):
188
+ """This is the help message for my_function."""
189
+ print(f"The API key is: {api_key}")
190
+
191
+ @my_group.command()
192
+ @env("API_KEY", required=True)
193
+ def my_function_2(api_key: str):
194
+ """This is the help message for my_function."""
195
+ print(f"The API key is: {api_key}")
196
+
197
+ if __name__ == "__main__":
198
+ my_group()
199
+ ```
200
+
201
+ ```bash
202
+ $ python cli.py my_function_1
203
+ The API key is: None
204
+ ```
205
+
206
+ ```bash
207
+ $ API_KEY=api-key python cli.py my_function_1
208
+ The API key is: api-key
209
+ ```
210
+
211
+ ```bash
212
+ $ python cli.py my_function_2
213
+ ProcessError (my_function_2): Required environment variable 'API_KEY' is not set.
214
+ ```
215
+
216
+ ```bash
217
+ $ API_KEY=api-key python cli.py my_function_2
218
+ The API key is: api-key
219
+ ```
220
+
221
+ ### Load CSV Data
222
+
223
+ ```python
224
+ import pandas as pd
225
+ from click_extended import command, argument
226
+ from click_extended.decorators import to_path, load_csv
227
+
228
+ @command()
229
+ @argument("file", param="data")
230
+ @to_path(extensions=["csv"], exists=True)
231
+ @load_csv()
232
+ def my_command(data: dict[str, Any], *args: Any, **kwargs: Any) -> None:
233
+ df = pd.DataFrame(data)
234
+ print(df.head())
235
+ ```
236
+
237
+ _Note: `pandas` is not installed in this library and must be installed manually due to size._
238
+
239
+ ### Pre-Built Children
240
+
241
+ This library includes a vast number of pre-built children, everything from checking values to transforming values.
242
+
243
+ ```python
244
+ from click_extended import command, argument, option
245
+ from click_extended.decorators import to_snake_case, strip, is_email, minimum, dependencies
246
+
247
+ @command()
248
+ @dependencies("username", "email", "password")
249
+ @argument("username")
250
+ @to_snake_case()
251
+ @strip()
252
+ @option("email")
253
+ @is_email()
254
+ @option("password")
255
+ @minimum(8)
256
+ def create_account(username: str, email: str, password: str) -> None:
257
+ print("Username:", username)
258
+ print("Email:", email)
259
+ print("Password:", password)
260
+ ```
261
+
262
+ ### Custom Nodes
263
+
264
+ If the library does not include a decorator you need, you can easily create your own. Read more about creating your own [children](./docs/core/CHILD_NODE.md), [validators](./docs/core/VALIDATION_NODE.md), [child validators](./docs/core/CHILD_VALIDATION_NODE.md) or [parents](./docs/core/PARENT_NODE.md).
265
+
266
+ ```python
267
+ from typing import Any
268
+
269
+ from click_extended import group, argument, option
270
+ from click_extended.classes import ChildNode
271
+ from click_extended.types import Context, Decorator
272
+
273
+ class MyCustomChild(ChildNode):
274
+ def handle_string(
275
+ self,
276
+ value: str,
277
+ context: Context,
278
+ *args: Any,
279
+ **kwargs: Any,
280
+ ) -> str:
281
+ if value == "invalid":
282
+ raise ValueError("The value 'invalid' is not valid")
283
+
284
+ return value.upper()
285
+
286
+ def my_custom_child() -> Decorator:
287
+ """Checks if the value is invalid and converts it to uppercase."""
288
+ return MyCustomChild.as_decorator()
289
+
290
+
291
+ @group()
292
+ def my_group():
293
+ """This is the help message for my_group."""
294
+ print("Running initialization code...")
295
+
296
+ @my_group.command(aliases=["ping", "repeat"])
297
+ @argument("value")
298
+ @my_custom_child()
299
+ def my_function(value: str):
300
+ """This is the help message for my_function."""
301
+ print(f"The value '{value}' should be uppercase.")
302
+
303
+ if __name__ == "__main__":
304
+ my_group()
305
+ ```
306
+
307
+ ```bash
308
+ $ python cli.py my_function valid
309
+ The value 'VALID' should be uppercase.
310
+ ```
311
+
312
+ ```bash
313
+ $ python cli.py my_function invalid
314
+ ValueError (my_function): "The value 'invalid' is not valid"
315
+ ```
316
+
317
+ ## Documentation
318
+
319
+ 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.
320
+
321
+ ## Contributing
322
+
323
+ Contributors are more than welcome to work on this project. Read the [contribution documentation](./CONTRIBUTING.md) to learn more.
324
+
325
+ ## License
326
+
327
+ This project is licensed under the MIT License, see the [license file](./LICENSE) for details.
328
+
329
+ ## Acknowledgements
330
+
331
+ This project is built on top of the [Click](https://github.com/pallets/click) library.
@@ -0,0 +1,10 @@
1
+ click_extended/__init__.py,sha256=wTarCHBxMz59fe0vCTyq8RiN0COooJ892C0N2OuPLLQ,640
2
+ click_extended/classes.py,sha256=SdwglQ7O5ahjYeVnaM9_hCU14BYZBv8C0ZjWQIo7A_I,837
3
+ click_extended/errors.py,sha256=tkvAXs4oUZ8SFgX37KhYrHAlsxmOGrSFLIezCH9NDQI,13897
4
+ click_extended/types.py,sha256=0YT4QN269H-01RVxDGSpMT_hJm8cTcONonpX4_YxJlg,238
5
+ click_extended-1.0.0.dist-info/licenses/AUTHORS.md,sha256=NkShPinjqtnRDQVRyVnfJuOGM56sejauE3WRoYCcbtw,132
6
+ click_extended-1.0.0.dist-info/licenses/LICENSE,sha256=gjO8hzM4mFSBXFikktaXVSgmXGcre91_GPJ-E_yP56E,1075
7
+ click_extended-1.0.0.dist-info/METADATA,sha256=l7TL-IV44rqCe0TzV7VHjjb7_dVtDxSdBBf9lsYmjes,10711
8
+ click_extended-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
+ click_extended-1.0.0.dist-info/top_level.txt,sha256=2G3bm6tCNv80okRm773jKTk-_z1ElY-seaozZrn_TxA,15
10
+ click_extended-1.0.0.dist-info/RECORD,,
@@ -1,257 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: click_extended
3
- Version: 0.3.2
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
- ![Banner](./assets/click-extended-banner.png)
65
-
66
- # Click Extended
67
-
68
- ![top language](https://img.shields.io/github/languages/top/marcusfrdk/click-extended)
69
- ![code size](https://img.shields.io/github/languages/code-size/marcusfrdk/click-extended)
70
- ![last commit](https://img.shields.io/github/last-commit/marcusfrdk/click-extended)
71
- ![issues](https://img.shields.io/github/issues/marcusfrdk/click-extended)
72
- ![contributors](https://img.shields.io/github/contributors/marcusfrdk/click-extended)
73
- ![PyPI](https://img.shields.io/pypi/v/click-extended)
74
- ![License](https://img.shields.io/github/license/marcusfrdk/click-extended)
75
- ![Downloads](https://static.pepy.tech/badge/click-extended)
76
- ![Monthly Downloads](https://static.pepy.tech/badge/click-extended/month)
77
-
78
- An extension of the [Click](https://github.com/pallets/click) library with additional features like aliasing, asynchronous support, an extended decorator API and more.
79
-
80
- ## Features
81
-
82
- - **Aliasing**: Add multiple aliases to a group or command.
83
- - **Async support**: Automatically run both synchronous and asynchronous functions.
84
- - **Extensible decorator API**: Extend the Click decorator API with custom decorators like validators, transformers, and more.
85
- - **Type-hint First**: Built using the type-hinting system to it's full potential.
86
- - **Environment variables**: Automatically validate and inject environment variables into the function.
87
- - **Help alias**: The `-h` and `--help` automatically show the help menu unless overridden.
88
-
89
- ## Installation
90
-
91
- ```bash
92
- pip install click-extended
93
- ```
94
-
95
- ## Requirements
96
-
97
- - **Python**: 3.10 or higher
98
-
99
- ## Quick Start
100
-
101
- ### Basic Command
102
-
103
- ```python
104
- from click_extended import command, option
105
-
106
- @command()
107
- @option("--name", default="World", help="Name to greet")
108
- @option("--count", type=int, default=1, help="Number of greetings")
109
- def greet(name: str, count: int):
110
- """Greet someone multiple times."""
111
- for _ in range(count):
112
- print(f"Hello, {name}!")
113
-
114
- if __name__ == "__main__":
115
- greet()
116
- ```
117
-
118
- ```bash
119
- $ python app.py --name Alice --count 3
120
- Hello, Alice!
121
- Hello, Alice!
122
- Hello, Alice!
123
- ```
124
-
125
- ### Async Support
126
-
127
- ```python
128
- import asyncio
129
-
130
- from click_extended import command, option
131
-
132
- @command()
133
- @option("--url", required=True, help="URL to fetch")
134
- async def fetch(url: str):
135
- """Fetch data from a URL asynchronously."""
136
- await asyncio.sleep(1)
137
- print(f"Fetched data from {url}")
138
-
139
- if __name__ == "__main__":
140
- fetch()
141
- ```
142
-
143
- ### Command Aliases
144
-
145
- ```python
146
- from click_extended import command, option
147
-
148
- @command(aliases=["hi", "hello"])
149
- @option("--name", default="World")
150
- def greet(name: str):
151
- """Greet someone."""
152
- print(f"Hello, {name}!")
153
-
154
- if __name__ == "__main__":
155
- greet()
156
- ```
157
-
158
- ```bash
159
- $ python app.py greet --name Alice
160
- Hello, Alice!
161
- $ python app.py hi --name Bob
162
- Hello, Bob!
163
- $ python app.py hello --name Charlie
164
- Hello, Charlie!
165
- ```
166
-
167
- ### Environment Variables
168
-
169
- Environment variables are automatically loaded from the `.env` file, but as long as the variable is defined in your system environment, it will work.
170
-
171
- ```txt
172
- API_TOKEN=secret123
173
- ```
174
-
175
- ```python
176
- from click_extended import command, option, env
177
-
178
- @command()
179
- @option("--token", help="API token")
180
- @env("API_TOKEN", name="token", required=True)
181
- def api_call(token: str):
182
- """Make an API call with authentication."""
183
- print(f"Using token: {token[:8]}...")
184
-
185
- if __name__ == "__main__":
186
- api_call()
187
- ```
188
-
189
- ```bash
190
- $ python app.py
191
- Using token: secret12...
192
- ```
193
-
194
- ### Custom Validators
195
-
196
- ```python
197
- from click_extended import command, option, ChildNode, ProcessContext
198
- from click_extended.errors import ValidationError
199
-
200
- class IsPositive(ChildNode):
201
- """Validate that a number is positive."""
202
-
203
- def process(self, value: float | int, context: ProcessContext):
204
- if value <= 0:
205
- raise ValidationError(f"{value} is not positive")
206
-
207
- def is_positive(*args, **kwargs):
208
- """Validate positive numbers."""
209
- return IsPositive.as_decorator(*args, **kwargs)
210
-
211
- @command()
212
- @option("--count", type=int, required=True)
213
- @is_positive()
214
- def process(count: int):
215
- """Process a positive number of items."""
216
- print(f"Processing {count} items")
217
-
218
- if __name__ == "__main__":
219
- process()
220
- ```
221
-
222
- ```bash
223
- $ python app.py --count 5
224
- Processing 5 items
225
- $ python app.py --count -1
226
- Usage: app.py [OPTIONS]
227
- Try 'app.py --help' for help.
228
-
229
- Error (--count): -1 is not positive
230
- ```
231
-
232
- ## Documentation
233
-
234
- ### Core Concepts
235
-
236
- - [Commands and Groups](./docs/ROOT_NODE.md) - CLI entry points
237
- - [Options, Arguments, and Environment Variables](./docs/PARENT_NODE.md) - Parameter sources
238
- - [Validators and Transformers](./docs/CHILD_NODE.md) - Value processing
239
- - [Global Nodes](./docs/GLOBAL_NODE.md) - Tree-level operations
240
- - [Tags](./docs/TAG.md) - Cross-parameter validation
241
- - [Tree Architecture](./docs/TREE.md) - Internal structure
242
-
243
- ### Guides
244
-
245
- - [Migrating from Click](./docs/MIGRATING_FROM_CLICK.md) - Upgrade guide
246
-
247
- ## Contributing
248
-
249
- Contributors are more than welcome to work on this project. Read the [contribution documentation](./CONTRIBUTING.md) to learn more.
250
-
251
- ## License
252
-
253
- This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
254
-
255
- ## Acknowledgements
256
-
257
- This project is built on top of the [Click](https://github.com/pallets/click) library.
@@ -1,9 +0,0 @@
1
- click_extended/__init__.py,sha256=wBUV7-CmgDBKSnDj3_MbYCjHv2zAaATQ795Y9Xs-0NE,858
2
- click_extended/errors.py,sha256=ITtVGZ1GosrrGnUbUuJQueoJqFCtJvj83dKJrQqkCmU,10500
3
- click_extended/types.py,sha256=9DGOs5x4CGwxlRLZe3zIacPtkWldZgix6hWQxcxJP_A,773
4
- click_extended-0.3.2.dist-info/licenses/AUTHORS.md,sha256=NkShPinjqtnRDQVRyVnfJuOGM56sejauE3WRoYCcbtw,132
5
- click_extended-0.3.2.dist-info/licenses/LICENSE,sha256=gjO8hzM4mFSBXFikktaXVSgmXGcre91_GPJ-E_yP56E,1075
6
- click_extended-0.3.2.dist-info/METADATA,sha256=_adGbk-vOJQKV-X0yTYfkmILjJDiAAGJbnkfp2ysY6g,8295
7
- click_extended-0.3.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
- click_extended-0.3.2.dist-info/top_level.txt,sha256=2G3bm6tCNv80okRm773jKTk-_z1ElY-seaozZrn_TxA,15
9
- click_extended-0.3.2.dist-info/RECORD,,