mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 18:18:03 +00:00
Prettier console
This commit is contained in:
parent
dd5310a85e
commit
b34e7e011e
3 changed files with 114 additions and 1 deletions
62
testing/cli_tests/console.py
Normal file
62
testing/cli_tests/console.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
from typing import Any, Optional, Union
|
||||
from rich.console import Console, JustifyMethod
|
||||
from rich.theme import Theme
|
||||
from rich.style import Style
|
||||
|
||||
|
||||
custom_theme = Theme({"info": "blue", "error": "bold red"})
|
||||
console = Console(theme=custom_theme)
|
||||
|
||||
|
||||
def info(
|
||||
*objects: Any,
|
||||
sep: str = " ",
|
||||
end: str = "\n",
|
||||
style: Optional[Union[str, Style]] = None,
|
||||
justify: Optional[JustifyMethod] = None,
|
||||
emoji: Optional[bool] = None,
|
||||
markup: Optional[bool] = None,
|
||||
highlight: Optional[bool] = None,
|
||||
log_locals: bool = False,
|
||||
_stack_offset: int = 1,
|
||||
):
|
||||
console.log(
|
||||
"[info]INFO[/info]",
|
||||
*objects,
|
||||
sep=sep,
|
||||
end=end,
|
||||
style=style,
|
||||
justify=justify,
|
||||
emoji=emoji,
|
||||
markup=markup,
|
||||
highlight=highlight,
|
||||
log_locals=log_locals,
|
||||
_stack_offset=_stack_offset,
|
||||
)
|
||||
|
||||
|
||||
def error(
|
||||
*objects: Any,
|
||||
sep: str = " ",
|
||||
end: str = "\n",
|
||||
style: Optional[Union[str, Style]] = None,
|
||||
justify: Optional[JustifyMethod] = None,
|
||||
emoji: Optional[bool] = None,
|
||||
markup: Optional[bool] = None,
|
||||
highlight: Optional[bool] = None,
|
||||
log_locals: bool = False,
|
||||
_stack_offset: int = 1,
|
||||
):
|
||||
console.log(
|
||||
"[error]ERROR[/error]",
|
||||
*objects,
|
||||
sep=sep,
|
||||
end=end,
|
||||
style=style,
|
||||
justify=justify,
|
||||
emoji=emoji,
|
||||
markup=markup,
|
||||
highlight=highlight,
|
||||
log_locals=log_locals,
|
||||
_stack_offset=_stack_offset,
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue