Skip to main content
← Back to list
01Issue
FeatureOpenSwamp CLI
Assigneesstack72

#347 Add table width controls to swamp report get

Opened by bixu · 5/13/2026

Problem

`swamp report get --workflow ` (default, non-`--json` output) renders report tables in ANSI/box-drawing form, sizing each column to the longest cell. For reports that legitimately carry long string fields, this produces tables hundreds of characters wide that don't fit any laptop terminal and wrap into illegible noise.

Concrete example (a kernel-CVE audit report I run regularly): the `linux-image package(s)` column lists every installed kernel package per host, and on a host with many old kernels the cell stretches the column past 400 chars. The whole table ends up ~600+ chars wide. On a 13–15" laptop terminal (~180 cols at default font) the table line-wraps inside each column and is unreadable. Cropping the terminal output through `less -S` works but loses the ANSI styling and pipes around the issue rather than fixing it.

The `--json` flag exists and is structured, but rebuilds the entire renderer by hand. The `--markdown` proposal in swamp.club Lab #346 (separately filed) would help by producing pipe-table syntax, but markdown pipe-tables have the same column-width problem when viewed in a fixed-width editor.

Proposed solution

Add a width-control flag to `swamp report get`:

``` swamp report get @some/report --workflow my-wf --max-width 200 swamp report get @some/report --workflow my-wf --max-col-width 60 ```

Behaviour:

  • `--max-width N` caps total table width at N columns. Long cells are truncated (with an ellipsis indicator like `…`) or wrapped at word/comma/separator boundaries inside the cell. The renderer picks per-column widths that sum to ≤ N while respecting header widths.
  • `--max-col-width N` caps any single column at N chars, leaving total width unbounded. Useful when one column is the offender and the rest are fine.
  • The two can combine (`--max-col-width` is applied first, then `--max-width` rebalances).
  • Default behaviour unchanged: with no flag set, render as today.
  • Should apply to both the default ANSI/box-drawing renderer and (if Lab #346 lands) the proposed markdown renderer.
  • An env var like `SWAMP_REPORT_MAX_WIDTH` would be a nice ergonomic addition so a user can default it once in their shell rc and not type the flag every time.

Alternatives considered

  • Pipe to `less -S`: works for the default ANSI output (truncates per-line rather than wrapping) but strips colour, breaks copy-paste, and doesn't help with markdown output saved to a file.
  • Tell users to write a custom renderer via `--json`: shifts the burden onto every report consumer. Defeats the point of a built-in human-readable renderer.
  • Auto-detect terminal width and apply transparently: appealing but surprising — tables look different depending on terminal size. An opt-in flag with a sensible env var is more predictable.

Acceptance criteria

  • `--max-width` and `--max-col-width` flags accepted by `swamp report get`.
  • Cells that exceed the cap are truncated or wrapped (renderer's choice) without breaking column-alignment in the surrounding rows.
  • Renders correctly for both the existing ANSI/box-drawing path and any future `--markdown` path.
  • No change to `--json` output.
02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED

Open

5/13/2026, 2:18:32 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack725/13/2026, 4:53:53 PM

Sign in to post a ripple.