Skip to content

Commit 4c01856

Browse files
committed
feat: Make max table lines configurable with config
#6 Branch: ConciseTables-6 Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
1 parent 5027304 commit 4c01856

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

cforge/common.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,15 @@ def print_table(
278278
console = get_console()
279279
table = Table(title=title, show_header=True, header_style="bold magenta")
280280
col_name_map = col_name_map or {}
281+
max_lines = get_settings().table_max_lines
281282

282283
for column in columns:
283284
table.add_column(col_name_map.get(column, column), style="cyan")
284285

285286
for item in data:
286-
row = [LineLimit(str(item.get(col, "")), max_lines=4) for col in columns]
287+
row = [str(item.get(col, "")) for col in columns]
288+
if max_lines > 0:
289+
row = [LineLimit(cell, max_lines=max_lines) for cell in row]
287290
table.add_row(*row)
288291

289292
console.print(table)

cforge/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ def _set_database_url_default(self) -> Self:
5959

6060
mcpgateway_bearer_token: Optional[str] = None
6161

62+
# Max number of lines for printed tables (<1 => infinite)
63+
table_max_lines: int = 4
64+
6265

6366
@lru_cache
6467
def get_settings() -> CLISettings:

0 commit comments

Comments
 (0)