Skip to content

Commit

Permalink
more adjustments to markdown readme #48
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Kohan committed Apr 3, 2024
1 parent c0c5a5a commit db1fd3e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 283 deletions.
40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# django-typer

![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)(https://lbesson.mit-license.org/)
![PyPI version](https://badge.fury.io/py/django-typer.svg)(https://pypi.python.org/pypi/django-typer/)
![PyPI pyversions](https://img.shields.io/pypi/pyversions/django-typer.svg)(https://pypi.python.org/pypi/django-typer/)
![PyPI djversions](https://img.shields.io/pypi/djversions/django-typer.svg)(https://pypi.org/project/django-typer/)
![PyPI status](https://img.shields.io/pypi/status/django-typer.svg)(https://pypi.python.org/pypi/django-typer)
![Documentation Status](https://readthedocs.org/projects/django-typer/badge/?version=latest)(http://django-typer.readthedocs.io/?badge=latest/)
![Code Cov](https://codecov.io/gh/bckohan/django-typer/branch/main/graph/badge.svg?token=0IZOKN2DYL)(https://codecov.io/gh/bckohan/django-typer)
![Test Status](https://github.com/bckohan/django-typer/workflows/test/badge.svg)(https://github.com/bckohan/django-typer/actions/workflows/test.yml)
![Lint Status](https://github.com/bckohan/django-typer/workflows/lint/badge.svg)(https://github.com/bckohan/django-typer/actions/workflows/lint.yml)
![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)(https://github.com/psf/black)

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.

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI version](https://badge.fury.io/py/django-typer.svg)](https://pypi.python.org/pypi/django-typer/)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/django-typer.svg)](https://pypi.python.org/pypi/django-typer/)
[![PyPI djversions](https://img.shields.io/pypi/djversions/django-typer.svg)](https://pypi.org/project/django-typer/)
[![PyPI status](https://img.shields.io/pypi/status/django-typer.svg)](https://pypi.python.org/pypi/django-typer)
[![Documentation Status](https://readthedocs.org/projects/django-typer/badge/?version=latest)](http://django-typer.readthedocs.io/?badge=latest/)
[![Code Cov](https://codecov.io/gh/bckohan/django-typer/branch/main/graph/badge.svg?token=0IZOKN2DYL)](https://codecov.io/gh/bckohan/django-typer)
[![Test Status](https://github.com/bckohan/django-typer/workflows/test/badge.svg)](https://github.com/bckohan/django-typer/actions/workflows/test.yml)
[![Lint Status](https://github.com/bckohan/django-typer/workflows/lint/badge.svg)](https://github.com/bckohan/django-typer/actions/workflows/lint.yml)
[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

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.

**django-typer makes it easy to:**

Expand All @@ -20,8 +21,8 @@ Use Typer to define the CLI for your Django management commands. Provides a Type
- Use the full power of Typer's parameter types to validate and parse command line inputs.
- Create beautiful and information dense help outputs.
- Configure the rendering of exception stack traces using rich.
- Install shell tab-completion support for TyperCommands and normal Django commands for bash, zsh, fish, and powershell.
- Create custom and portable shell tab-completions for your CLI parameters.
- [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).
- [Create custom and portable shell tab-completions for your CLI parameters.](https://django-typer.readthedocs.io/en/latest/shell_completion.html#defining-custom-completions)
- Refactor existing management commands into TyperCommands because TyperCommand is interface compatible with BaseCommand.

Please refer to the [full documentation](https://django-typer.readthedocs.io/) for more information.
Expand Down Expand Up @@ -51,11 +52,11 @@ Please refer to the [full documentation](https://django-typer.readthedocs.io/) f
]
```

*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.*
*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.*

## Basic Example

For example, TyperCommands can be a very simple drop-in replacement for BaseCommands. All of the documented features of BaseCommand work!
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!

```python
from django_typer import TyperCommand
Expand Down Expand Up @@ -96,10 +97,12 @@ class Command(TyperCommand):
```

![Multiple Subcommands Example](https://raw.githubusercontent.com/bckohan/django-typer/main/django_typer/examples/helps/multi.svg)
![Multiple Subcommands Example - create](https://raw.githubusercontent.com/bckohan/django-typer/main/django_typer/examples/helps/multi_create.svg)
![Multiple Subcommands Example - delete](https://raw.githubusercontent.com/bckohan/django-typer/main/django_typer/examples/helps/multi_delete.svg)

## Grouping and Hierarchies Example

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:
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:

```bash
./manage.py hierarchy math --precision 5 divide 10 2.1
Expand Down Expand Up @@ -133,3 +136,6 @@ class Command(TyperCommand):
```
![Grouping and Hierarchies Example](https://raw.githubusercontent.com/bckohan/django-typer/main/django_typer/examples/helps/hierarchy.svg)
![Grouping and Hierarchies Example](https://raw.githubusercontent.com/bckohan/django-typer/main/django_typer/examples/helps/hierarchy_math.svg)
![Grouping and Hierarchies Example](https://raw.githubusercontent.com/bckohan/django-typer/main/django_typer/examples/helps/hierarchy_math_multiply.svg)
![Grouping and Hierarchies Example](https://raw.githubusercontent.com/bckohan/django-typer/main/django_typer/examples/helps/hierarchy_math_divide.svg)
266 changes: 0 additions & 266 deletions README.rst

This file was deleted.

0 comments on commit db1fd3e

Please sign in to comment.