Skip to content

Commit d779831

Browse files
authored
Merge pull request #24 from eadwinCode/runserver_fix
runserver --help fix
2 parents c7fd7c8 + 6271ba2 commit d779831

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

ellar_cli/manage_commands/runserver.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
from pathlib import Path
55

66
import typer
7-
from ellar.constants import LOG_LEVELS
87
from ellar.helper.enums import create_enums_from_list
98
from h11._connection import DEFAULT_MAX_INCOMPLETE_EVENT_SIZE
109
from uvicorn.config import (
1110
HTTP_PROTOCOLS,
1211
INTERFACES,
1312
LIFESPAN,
13+
LOG_LEVELS,
1414
LOGGING_CONFIG,
1515
LOOP_SETUPS,
1616
SSL_PROTOCOL_VERSION,
@@ -32,6 +32,8 @@
3232
"LOOP_CHOICES", *[key for key in LOOP_SETUPS.keys() if key != "none"]
3333
)
3434
INTERFACE_CHOICES = create_enums_from_list("INTERFACES", *INTERFACES)
35+
_LOG_LEVELS = dict(**LOG_LEVELS, NOT_SET=0)
36+
LOG_LEVELS_CHOICES = create_enums_from_list("LOG_LEVELS", *list(_LOG_LEVELS.keys()))
3537

3638

3739
def runserver(
@@ -112,8 +114,8 @@ def runserver(
112114
env_file: t.Optional[Path] = typer.Option(
113115
None, show_default=True, exists=True, help="Environment configuration file."
114116
),
115-
log_level: t.Optional[LOG_LEVELS] = typer.Option(
116-
None,
117+
log_level: LOG_LEVELS_CHOICES = typer.Option(
118+
LOG_LEVELS_CHOICES.NOT_SET.value,
117119
show_default=True,
118120
help="Log level. [default: None]",
119121
),
@@ -266,7 +268,7 @@ def runserver(
266268
lifespan=lifespan.value,
267269
env_file=env_file,
268270
log_config=LOGGING_CONFIG if log_config is None else log_config,
269-
log_level=_log_level.name,
271+
log_level=_log_level.value if _log_level.value != "NOT_SET" else None,
270272
access_log=access_log,
271273
interface=interface.value,
272274
reload=reload,

ellar_cli/scaffolding/module_template/module_name/tests/__init__.ellar

Whitespace-only changes.

ellar_cli/scaffolding/module_template/setup.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
"name": "tests",
2828
"is_directory": "true",
2929
"files": [
30+
{
31+
"name": "__init__.ellar"
32+
},
3033
{
3134
"name": "test_controllers.ellar"
3235
},

0 commit comments

Comments
 (0)