Skip to content

Commit 7d5a912

Browse files
authored
Merge pull request #36 from aclark4life/main
Refactor with typer
2 parents 2d125a1 + 889508a commit 7d5a912

File tree

16 files changed

+885
-1558
lines changed

16 files changed

+885
-1558
lines changed

README.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,3 @@ python -m venv .venv
1818
source .venv/bin/activate
1919
just install
2020
```
21-
22-
## Usage
23-
24-
```
25-
Usage: dm [OPTIONS] COMMAND [ARGS]...
26-
27-
Django MongoDB CLI
28-
29-
System executable:
30-
31-
/Users/alexclark/Developer/django-mongodb-cli/.venv/bin/python
32-
33-
Options:
34-
--help Show this message and exit.
35-
36-
Commands:
37-
app Create Django apps configured to test django-mongodb-backend.
38-
proj Create Django projects configured to test django-mongodb-backend.
39-
repo Run tests configured to test django-mongodb-backend.
40-
```

django_mongodb_cli/__init__.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1-
import click
2-
import sys
1+
import os
2+
import typer
33

4-
from .app import app
5-
from .proj import proj
64
from .repo import repo
75

8-
9-
def get_help_text():
10-
help_text = """
11-
Django MongoDB CLI
6+
help_text = (
127
"""
13-
return f"\n\n{help_text.strip()}\n\nSystem executable:\n\n{sys.executable}\n"
14-
8+
Django MongoDB CLI
159
16-
@click.group(help=get_help_text())
17-
def cli():
18-
"""Django MongoDB CLI"""
10+
System executable:
11+
"""
12+
+ os.sys.executable
13+
)
1914

15+
dm = typer.Typer(
16+
help=help_text,
17+
add_completion=False,
18+
context_settings={"help_option_names": ["-h", "--help"]},
19+
)
2020

21-
cli.add_command(app)
22-
cli.add_command(proj)
23-
cli.add_command(repo)
21+
dm.add_typer(repo, name="repo")

django_mongodb_cli/app.py

Lines changed: 0 additions & 72 deletions
This file was deleted.

django_mongodb_cli/proj.py

Lines changed: 0 additions & 173 deletions
This file was deleted.

0 commit comments

Comments
 (0)