Skip to content

Commit 90f14b7

Browse files
committed
Create a banner output for boxed content
1 parent 6df976f commit 90f14b7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

devcli/framework/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .base import new, stop, logger
22

3-
from .console import echo, info, warn, error, json, table
3+
from .console import echo, info, warn, error, json, table, banner
44

55
__all__ = [
66
# from console
@@ -10,6 +10,7 @@
1010
"error",
1111
"echo",
1212
"info",
13+
"banner",
1314
"table",
1415
# from base
1516
"new",

devcli/framework/console.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ def info(msg: str):
4343
print(f"[cyan]{msg}[/cyan]")
4444

4545

46+
def banner(msg: str):
47+
""" Uses a table to make a boxed banner """
48+
table([[msg]], True)
49+
50+
4651
def table(table: List[List[str]] = [[]], as_grid: bool = False):
4752
"""
4853
Prints a simple table, for complex tables use rich.Table directly.
@@ -54,6 +59,8 @@ def table(table: List[List[str]] = [[]], as_grid: bool = False):
5459
["Row 1A", "Row 1B"],
5560
["Row 2A", "Row 2B"]
5661
]
62+
63+
as_grid: bool
5764
"""
5865
rich_table = None
5966
table_copy = table.copy() # avoid altering param

0 commit comments

Comments
 (0)