-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from bckohan/v1.1.x
Pull in version 1.1.2
- Loading branch information
Showing
5 changed files
with
90 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
django_typer/tests/test_app/management/commands/override.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import sys | ||
|
||
from django_typer import TyperCommand | ||
|
||
if sys.version_info < (3, 9): | ||
from typing_extensions import Annotated | ||
else: | ||
from typing import Annotated | ||
|
||
import typing as t | ||
from enum import Enum | ||
from pathlib import Path | ||
|
||
from typer import Argument, Option | ||
|
||
|
||
class VersionEnum(str, Enum): | ||
|
||
VERSION1 = "1" | ||
VERSION1_1 = "1.1" | ||
VERSION2 = "2" | ||
|
||
|
||
class Command(TyperCommand): | ||
help = "Override some default django options." | ||
|
||
def handle( | ||
self, | ||
settings: Annotated[Path, Argument(help="Override default settings argument.")], | ||
optional_arg: Annotated[int, Argument(help="An optional argument.")] = 0, | ||
version: Annotated[ | ||
t.Optional[VersionEnum], | ||
Option("--version", help="Override default version argument."), | ||
] = None, | ||
): | ||
return { | ||
"settings": settings, | ||
"version": version, | ||
**({"optional_arg": optional_arg} if optional_arg else {}), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "django-typer" | ||
version = "1.1.1" | ||
version = "1.1.2" | ||
description = "Use Typer to define the CLI for your Django management commands." | ||
authors = ["Brian Kohan <[email protected]>"] | ||
license = "MIT" | ||
|