2
2
Common types for command line argument specification.
3
3
"""
4
4
5
- # pylint: disable=pointless-string-statement
5
+ # pylint: disable=pointless-string-statement, line-too-long
6
6
7
7
import sys
8
8
from pathlib import Path
@@ -53,9 +53,6 @@ def set_force_color(context, param, value):
53
53
return value
54
54
55
55
56
- """
57
- https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand.get_version
58
- """
59
56
Version = Annotated [
60
57
bool ,
61
58
Option (
@@ -66,10 +63,14 @@ def set_force_color(context, param, value):
66
63
rich_help_panel = COMMON_PANEL ,
67
64
),
68
65
]
69
-
70
66
"""
71
- https://docs.djangoproject.com/en/stable/ref/django-admin/#cmdoption-verbosity
67
+ The type hint for the
68
+ `Django --version option <https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand.get_version>`_.
69
+
70
+ The --version option is included by default and behaves the same as on BaseCommand_.
72
71
"""
72
+
73
+
73
74
Verbosity = Annotated [
74
75
int ,
75
76
Option (
@@ -83,10 +84,20 @@ def set_force_color(context, param, value):
83
84
rich_help_panel = COMMON_PANEL ,
84
85
),
85
86
]
86
-
87
87
"""
88
- https://docs.djangoproject.com/en/stable/ref/django-admin/#cmdoption-settings
88
+ The type hint for the
89
+ `Django --verbosity option <https://docs.djangoproject.com/en/stable/ref/django-admin/#cmdoption-verbosity>`_.
90
+ :class:`~django_typer.TyperCommand` does not include the verbosity option by default, but it can be
91
+ added to the command like so if needed.
92
+
93
+ .. code-block:: python
94
+
95
+ from django_typer.types import Verbosity
96
+
97
+ def handle(self, verbosity: Verbosity = 1):
98
+ ...
89
99
"""
100
+
90
101
Settings = Annotated [
91
102
str ,
92
103
Option (
@@ -98,10 +109,15 @@ def set_force_color(context, param, value):
98
109
rich_help_panel = COMMON_PANEL ,
99
110
),
100
111
]
101
-
102
112
"""
103
- https://docs.djangoproject.com/en/stable/ref/django-admin/#cmdoption-pythonpath
113
+ The type hint for the
114
+ `Django --settings option <https://docs.djangoproject.com/en/stable/ref/django-admin/#cmdoption-settings>`_.
115
+
116
+ The --settings option is included by default and behaves the same as on BaseCommand_ use it to
117
+ specify or override the settings module to use.
104
118
"""
119
+
120
+
105
121
PythonPath = Annotated [
106
122
Optional [Path ],
107
123
Option (
@@ -112,10 +128,15 @@ def set_force_color(context, param, value):
112
128
rich_help_panel = COMMON_PANEL ,
113
129
),
114
130
]
115
-
116
131
"""
117
- https://docs.djangoproject.com/en/stable/ref/django-admin/#cmdoption-traceback
132
+ The type hint for the
133
+ `Django --pythonpath option <https://docs.djangoproject.com/en/stable/ref/django-admin/#cmdoption-pythonpath>`_.
134
+
135
+ The --pythonpath option is included by default and behaves the same as on BaseCommand_ use it to
136
+ specify a directory to add to the Python sys path.
118
137
"""
138
+
139
+
119
140
Traceback = Annotated [
120
141
bool ,
121
142
Option (
@@ -124,10 +145,15 @@ def set_force_color(context, param, value):
124
145
rich_help_panel = COMMON_PANEL ,
125
146
),
126
147
]
127
-
128
148
"""
129
- https://docs.djangoproject.com/en/stable/ref/django-admin/#cmdoption-no-color
149
+ The type hint for the
150
+ `Django --traceback option <https://docs.djangoproject.com/en/stable/ref/django-admin/#cmdoption-traceback>`_.
151
+
152
+ The --traceback option is included by default and behaves the same as on BaseCommand_ use it to
153
+ allow CommandError exceptions to propagate out of the command and produce a stack trace.
130
154
"""
155
+
156
+
131
157
NoColor = Annotated [
132
158
bool ,
133
159
Option (
@@ -138,11 +164,15 @@ def set_force_color(context, param, value):
138
164
rich_help_panel = COMMON_PANEL ,
139
165
),
140
166
]
141
-
142
-
143
167
"""
144
- https://docs.djangoproject.com/en/stable/ref/django-admin/#cmdoption-force-color
168
+ The type hint for the
169
+ `Django --no-color option <https://docs.djangoproject.com/en/stable/ref/django-admin/#cmdoption-no-color>`_.
170
+
171
+ The --no-color option is included by default and behaves the same as on BaseCommand_ use it to
172
+ force disable colorization of the command. You can check the supplied value of --no-color by
173
+ checking the no_color attribute of the command instance.
145
174
"""
175
+
146
176
ForceColor = Annotated [
147
177
bool ,
148
178
Option (
@@ -153,16 +183,28 @@ def set_force_color(context, param, value):
153
183
rich_help_panel = COMMON_PANEL ,
154
184
),
155
185
]
156
-
157
186
"""
158
- https://docs.djangoproject.com/en/stable/ref/django-admin/#cmdoption-skip-checks
187
+ The type hint for the
188
+ `Django --force-color option <https://docs.djangoproject.com/en/stable/ref/django-admin/#cmdoption-force-color>`_.
189
+
190
+ The --force-color option is included by default and behaves the same as on BaseCommand_ use it to
191
+ force colorization of the command. You can check the supplied value of --force-color by checking
192
+ the force_color attribute of the command instance.
159
193
"""
194
+
160
195
SkipChecks = Annotated [
161
196
bool ,
162
197
Option (
163
198
"--skip-checks" , help = _ ("Skip system checks." ), rich_help_panel = COMMON_PANEL
164
199
),
165
200
]
201
+ """
202
+ The type hint for the
203
+ `Django --skip-checks option <https://docs.djangoproject.com/en/stable/ref/django-admin/#cmdoption-skip-checks>`_.
204
+
205
+ The --skip-checks option is included by default and behaves the same as on BaseCommand_ use it to
206
+ skip system checks.
207
+ """
166
208
167
209
168
210
class Style (ColorStyle ):
0 commit comments