Skip to content

Commit 7fe289a

Browse files
committed
Removed bottom border from verbose help table.
1 parent e7b017e commit 7fe289a

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

cmd2/cmd2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4135,11 +4135,13 @@ def print_topics(self, header: str, cmds: list[str] | None, cmdlen: int, maxcol:
41354135
if not cmds:
41364136
return
41374137

4138+
# Add a row that looks like a table header.
41384139
header_grid = Table.grid()
41394140
header_grid.add_row(header, style=Cmd2Style.HELP_HEADER)
41404141
header_grid.add_row(Rule(characters=self.ruler, style=Cmd2Style.TABLE_BORDER))
41414142
self.poutput(Padding.indent(header_grid, 1))
41424143

4144+
# Print the topics in columns.
41434145
# Subtract 1 from maxcol to account for indentation.
41444146
maxcol = min(maxcol, ru.console_width()) - 1
41454147
columnized_cmds = self.render_columns(cmds, maxcol)
@@ -4166,7 +4168,7 @@ def _print_documented_command_topics(self, header: str, cmds: list[str], verbose
41664168
topics_table = Table(
41674169
Column("Name", no_wrap=True),
41684170
Column("Description", overflow="fold"),
4169-
box=rich.box.HORIZONTALS,
4171+
box=ru.TOP_AND_HEAD,
41704172
border_style=Cmd2Style.TABLE_BORDER,
41714173
)
41724174

cmd2/rich_utils.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
TypedDict,
99
)
1010

11+
from rich.box import Box
1112
from rich.console import (
1213
Console,
1314
ConsoleRenderable,
@@ -105,6 +106,19 @@ class RichPrintKwargs(TypedDict, total=False):
105106
new_line_start: bool
106107

107108

109+
# Custom Rich Box for tables which has a top border and a head row separator.
110+
TOP_AND_HEAD: Box = Box(
111+
" ── \n" # top
112+
" \n"
113+
" ── \n" # head_row
114+
" \n"
115+
" \n"
116+
" \n"
117+
" \n"
118+
" \n"
119+
)
120+
121+
108122
class Cmd2BaseConsole(Console):
109123
"""Base class for all cmd2 Rich consoles.
110124

0 commit comments

Comments
 (0)