Skip to content

Commit b59dbd8

Browse files
authored
Merge pull request #79 from bckohan/v1.2.x
V2.0.1
2 parents eef72c5 + d598785 commit b59dbd8

File tree

7 files changed

+43
-11
lines changed

7 files changed

+43
-11
lines changed

README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def main(arg1: str, arg2: str, arg3: float = 0.5, arg4: int = 1):
8484
"""
8585
```
8686

87-
![Basic Example](https://raw.githubusercontent.com/bckohan/django-typer/main/django_typer/examples/helps/basic.svg)
87+
![Basic Example](https://raw.githubusercontent.com/bckohan/django-typer/main/examples/helps/basic.svg)
8888

8989
## Multiple Subcommands Example
9090

@@ -153,9 +153,10 @@ def delete(
153153
"""
154154
```
155155

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

160161
## Grouping and Hierarchies Example
161162

@@ -275,7 +276,7 @@ def divide(
275276
return f"{numerator / denominator:.{self.precision}f}"
276277
```
277278

278-
![Grouping and Hierarchies Example](https://raw.githubusercontent.com/bckohan/django-typer/main/django_typer/examples/helps/hierarchy.svg)
279-
![Grouping and Hierarchies Example - math](https://raw.githubusercontent.com/bckohan/django-typer/main/django_typer/examples/helps/hierarchy_math.svg)
280-
![Grouping and Hierarchies Example - math multiply](https://raw.githubusercontent.com/bckohan/django-typer/main/django_typer/examples/helps/hierarchy_math_multiply.svg)
281-
![Grouping and Hierarchies Example - math divide](https://raw.githubusercontent.com/bckohan/django-typer/main/django_typer/examples/helps/hierarchy_math_divide.svg)
279+
![Grouping and Hierarchies Example](https://raw.githubusercontent.com/bckohan/django-typer/main/examples/helps/hierarchy.svg)
280+
![Grouping and Hierarchies Example - math](https://raw.githubusercontent.com/bckohan/django-typer/main/examples/helps/hierarchy_math.svg)
281+
![Grouping and Hierarchies Example - math multiply](https://raw.githubusercontent.com/bckohan/django-typer/main/examples/helps/hierarchy_math_multiply.svg)
282+
![Grouping and Hierarchies Example - math divide](https://raw.githubusercontent.com/bckohan/django-typer/main/examples/helps/hierarchy_math_divide.svg)

backup.py

-1
This file was deleted.

django_typer/tests/apps/test_app/management/commands/completion.py

+15
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,21 @@ def handle(
9393
),
9494
),
9595
] = [],
96+
app_opt: Annotated[
97+
t.List[str],
98+
typer.Option(
99+
help=_("One or more application labels."),
100+
shell_complete=completers.complete_app_label,
101+
),
102+
] = ["test_app"],
103+
databases: Annotated[
104+
t.List[str],
105+
typer.Option(
106+
"--db",
107+
help=_("One or more database aliases."),
108+
shell_complete=completers.databases(),
109+
),
110+
] = [],
96111
):
97112
assert self.__class__ is Command
98113
for app in django_apps:

django_typer/tests/test_parser_completers.py

+14
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ def test_app_label_parser_completers(self):
122122
self.assertTrue("messages" in result)
123123
self.assertTrue("staticfiles" in result)
124124

125+
result = StringIO()
126+
with contextlib.redirect_stdout(result):
127+
call_command("shellcompletion", "complete", "completion --app-opt ")
128+
result = result.getvalue()
129+
self.assertTrue("test_app" in result)
130+
self.assertTrue("django_typer_tests_apps_util" in result)
131+
125132
result = StringIO()
126133
with contextlib.redirect_stdout(result):
127134
call_command(
@@ -1380,3 +1387,10 @@ def test_chain_and_commands_completer(self):
13801387
self.assertFalse("dj_params2" in result)
13811388
self.assertFalse("dj_params3" in result)
13821389
self.assertFalse("dj_params4" in result)
1390+
1391+
def test_databases_completer(self):
1392+
result = run_command("shellcompletion", "complete", "completion --db ")[
1393+
0
1394+
].strip()
1395+
1396+
self.assertTrue("default" in result)

doc/source/changelog.rst

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Change Log
33
==========
44

5+
v2.0.1
6+
======
7+
8+
* Fixed `Readme images are broken. <https://github.com/bckohan/django-typer/issues/77>`_
9+
510
v2.0.0
611
======
712

examples.py

-1
This file was deleted.

howto.py

-1
This file was deleted.

0 commit comments

Comments
 (0)