Skip to content

Commit d2c904a

Browse files
committed
more docs
1 parent 9040678 commit d2c904a

File tree

5 files changed

+73
-27
lines changed

5 files changed

+73
-27
lines changed

django_typer/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,15 @@
100100
__copyright__ = "Copyright 2023-2024 Brian Kohan"
101101

102102

103-
__all__ = ["TyperCommand", "Context", "initialize", "command", "group", "get_command"]
103+
__all__ = [
104+
"TyperCommand",
105+
"Context",
106+
"initialize",
107+
"command",
108+
"group",
109+
"get_command",
110+
"model_parser_completer",
111+
]
104112

105113

106114
def model_parser_completer(

django_typer/types.py

Lines changed: 61 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Common types for command line argument specification.
33
"""
44

5-
# pylint: disable=pointless-string-statement
5+
# pylint: disable=pointless-string-statement, line-too-long
66

77
import sys
88
from pathlib import Path
@@ -53,9 +53,6 @@ def set_force_color(context, param, value):
5353
return value
5454

5555

56-
"""
57-
https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand.get_version
58-
"""
5956
Version = Annotated[
6057
bool,
6158
Option(
@@ -66,10 +63,14 @@ def set_force_color(context, param, value):
6663
rich_help_panel=COMMON_PANEL,
6764
),
6865
]
69-
7066
"""
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_.
7271
"""
72+
73+
7374
Verbosity = Annotated[
7475
int,
7576
Option(
@@ -83,10 +84,20 @@ def set_force_color(context, param, value):
8384
rich_help_panel=COMMON_PANEL,
8485
),
8586
]
86-
8787
"""
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+
...
8999
"""
100+
90101
Settings = Annotated[
91102
str,
92103
Option(
@@ -98,10 +109,15 @@ def set_force_color(context, param, value):
98109
rich_help_panel=COMMON_PANEL,
99110
),
100111
]
101-
102112
"""
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.
104118
"""
119+
120+
105121
PythonPath = Annotated[
106122
Optional[Path],
107123
Option(
@@ -112,10 +128,15 @@ def set_force_color(context, param, value):
112128
rich_help_panel=COMMON_PANEL,
113129
),
114130
]
115-
116131
"""
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.
118137
"""
138+
139+
119140
Traceback = Annotated[
120141
bool,
121142
Option(
@@ -124,10 +145,15 @@ def set_force_color(context, param, value):
124145
rich_help_panel=COMMON_PANEL,
125146
),
126147
]
127-
128148
"""
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.
130154
"""
155+
156+
131157
NoColor = Annotated[
132158
bool,
133159
Option(
@@ -138,11 +164,15 @@ def set_force_color(context, param, value):
138164
rich_help_panel=COMMON_PANEL,
139165
),
140166
]
141-
142-
143167
"""
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.
145174
"""
175+
146176
ForceColor = Annotated[
147177
bool,
148178
Option(
@@ -153,16 +183,28 @@ def set_force_color(context, param, value):
153183
rich_help_panel=COMMON_PANEL,
154184
),
155185
]
156-
157186
"""
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.
159193
"""
194+
160195
SkipChecks = Annotated[
161196
bool,
162197
Option(
163198
"--skip-checks", help=_("Skip system checks."), rich_help_panel=COMMON_PANEL
164199
),
165200
]
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+
"""
166208

167209

168210
class Style(ColorStyle):

doc/source/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
# This pattern also affects html_static_path and html_extra_path.
6060
exclude_patterns = []
6161

62-
6362
# -- Options for HTML output -------------------------------------------------
6463

6564
# The theme to use for HTML and HTML Help pages. See the documentation for

doc/source/reference.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ django_typer
1515
:members:
1616
:undoc-members:
1717
:show-inheritance:
18-
:private-members:
19-
2018

2119
.. _types:
2220

@@ -77,4 +75,3 @@ shellcompletion
7775

7876
.. automodule:: django_typer.management.commands.shellcompletion
7977
:members:
80-

doc/source/shell_completion.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
.. _shellcompletions:
44

5-
=================
6-
Shell Completions
7-
=================
5+
=====================
6+
Shell Tab-Completions
7+
=====================
88

99
.. image:: /_static/img/closepoll_example.gif
1010
:align: center

0 commit comments

Comments
 (0)