Fix MOTD for extra data
This commit is contained in:
parent
16256522f6
commit
f651f7436f
|
@ -73,6 +73,14 @@ class MOTDTTY(MOTD):
|
||||||
self.value_width = min(
|
self.value_width = min(
|
||||||
max(map(len, self.data.values())), self.max_value_width
|
max(map(len, self.data.values())), self.max_value_width
|
||||||
)
|
)
|
||||||
|
if self.extra:
|
||||||
|
self.key_width = max(
|
||||||
|
self.key_width, max(map(len, self.extra.keys()))
|
||||||
|
)
|
||||||
|
self.value_width = min(
|
||||||
|
max((*map(len, self.extra.values()), self.value_width)),
|
||||||
|
self.max_value_width,
|
||||||
|
)
|
||||||
self.logo_lines = self.logo.split("\n") if self.logo else []
|
self.logo_lines = self.logo.split("\n") if self.logo else []
|
||||||
self.logo_line_length = 24
|
self.logo_line_length = 24
|
||||||
self.centering_length = (
|
self.centering_length = (
|
||||||
|
|
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from asyncio import (
|
from asyncio import (
|
||||||
AbstractEventLoop,
|
AbstractEventLoop,
|
||||||
CancelledError,
|
CancelledError,
|
||||||
|
@ -71,7 +70,6 @@ from sanic.worker.multiplexer import WorkerMultiplexer
|
||||||
from sanic.worker.reloader import Reloader
|
from sanic.worker.reloader import Reloader
|
||||||
from sanic.worker.serve import worker_serve
|
from sanic.worker.serve import worker_serve
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from sanic import Sanic
|
from sanic import Sanic
|
||||||
from sanic.application.state import ApplicationState
|
from sanic.application.state import ApplicationState
|
||||||
|
@ -90,6 +88,7 @@ else: # no cov
|
||||||
class StartupMixin(metaclass=SanicMeta):
|
class StartupMixin(metaclass=SanicMeta):
|
||||||
_app_registry: ClassVar[Dict[str, Sanic]]
|
_app_registry: ClassVar[Dict[str, Sanic]]
|
||||||
|
|
||||||
|
name: str
|
||||||
config: Config
|
config: Config
|
||||||
listeners: Dict[str, List[ListenerType[Any]]]
|
listeners: Dict[str, List[ListenerType[Any]]]
|
||||||
state: ApplicationState
|
state: ApplicationState
|
||||||
|
@ -605,6 +604,7 @@ class StartupMixin(metaclass=SanicMeta):
|
||||||
server = "ASGI" if self.asgi else "unknown" # type: ignore
|
server = "ASGI" if self.asgi else "unknown" # type: ignore
|
||||||
|
|
||||||
display = {
|
display = {
|
||||||
|
"app": self.name,
|
||||||
"mode": " ".join(mode),
|
"mode": " ".join(mode),
|
||||||
"server": server,
|
"server": server,
|
||||||
"python": platform.python_version(),
|
"python": platform.python_version(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user