You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use Typer to define the CLI for your Django management commands. Provides a TyperCommand class that inherits from BaseCommand and allows typer-style annotated parameter types. All of the BaseCommand functionality is preserved, so that TyperCommand can be a drop-in replacement.
Use [Typer](https://typer.tiangolo.com/) to define the CLI for your [Django](https://www.djangoproject.com/) management commands. Provides a TyperCommand class that inherits from [BaseCommand](https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand) and allows typer-style annotated parameter types. All of the BaseCommand functionality is preserved, so that TyperCommand can be a drop-in replacement.
15
16
16
17
**django-typer makes it easy to:**
17
18
@@ -20,8 +21,8 @@ Use Typer to define the CLI for your Django management commands. Provides a Type
20
21
- Use the full power of Typer's parameter types to validate and parse command line inputs.
21
22
- Create beautiful and information dense help outputs.
22
23
- Configure the rendering of exception stack traces using rich.
23
-
- Install shell tab-completion support for TyperCommands and normal Django commands for bash, zsh, fish, and powershell.
24
-
- Create custom and portable shell tab-completions for your CLI parameters.
24
+
-[Install shell tab-completion support](https://django-typer.readthedocs.io/en/latest/shell_completion.html) for TyperCommands and normal Django commands for [bash](https://www.gnu.org/software/bash/), [zsh](https://www.zsh.org/), [fish](https://fishshell.com/), and [powershell](https://learn.microsoft.com/en-us/powershell/scripting/overview).
25
+
-[Create custom and portable shell tab-completions for your CLI parameters.](https://django-typer.readthedocs.io/en/latest/shell_completion.html#defining-custom-completions)
25
26
- Refactor existing management commands into TyperCommands because TyperCommand is interface compatible with BaseCommand.
26
27
27
28
Please refer to the [full documentation](https://django-typer.readthedocs.io/) for more information.
@@ -51,11 +52,11 @@ Please refer to the [full documentation](https://django-typer.readthedocs.io/) f
51
52
]
52
53
```
53
54
54
-
*You only need to install django_typer as an app if you want to use the shell completion command to enable tab-completion or if you would like django-typer to install rich traceback rendering for you - which it does by default if rich is also installed.*
55
+
*You only need to install django_typer as an app if you want to use the shell completion command to enable tab-completion or if you would like django-typer to install [rich traceback rendering](https://django-typer.readthedocs.io/en/latest/howto.html#configure-rich-stack-traces) for you - which it does by default if rich is also installed.*
55
56
56
57
## Basic Example
57
58
58
-
For example, TyperCommands can be a very simple drop-in replacement for BaseCommands. All of the documented features of BaseCommand work!
59
+
For example, TyperCommands can be a very simple drop-in replacement for BaseCommands. All of the documented features of [BaseCommand](https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand) work!

101
+

99
102
100
103
## Grouping and Hierarchies Example
101
104
102
-
More complex groups and subcommand hierarchies can be defined. For example, this command defines a group of commands called math, with subcommands divide and multiply:
105
+
More complex groups and subcommand hierarchies can be defined. For example, this command defines a group of commands called math, with subcommands divide and multiply. The group has a common initializer that optionally sets a float precision value. We would invoke this command like so:
103
106
104
107
```bash
105
108
./manage.py hierarchy math --precision 5 divide 10 2.1
@@ -133,3 +136,6 @@ class Command(TyperCommand):
133
136
```
134
137
135
138

139
+

140
+

141
+

0 commit comments