Honor --no-headers for --fmt and --table output (#566)

`--no-headers` was only applied to `--csv`/`--tsv` output. For the tabulate
formats (`--fmt ...` and `-t`/`--table`) the flag was silently ignored, so
`sqlite-utils query db "select ..." --fmt plain --no-headers` still printed the
column-name header row.

Both `tabulate.tabulate(...)` call sites (the `query`/`memory` output and the
`rows`/`tables` output) now pass `headers=()` when `--no-headers` is set, which
suppresses the header row across every tabulate format while leaving the
default (headers shown) untouched. The CSV/TSV behaviour is unchanged.

Also clarifies the `--no-headers` help text, which previously said "Omit CSV
headers", and regenerates docs/cli-reference.rst via cog to match.

Adds test_output_table_no_headers covering --fmt simple, -t and --fmt github
for both the query and rows commands.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Johnson K C 2026-06-07 20:35:15 -04:00
commit de2601c42f
3 changed files with 67 additions and 11 deletions

View file

@ -115,7 +115,7 @@ See :ref:`cli_query`.
--arrays Output rows as arrays instead of objects
--csv Output CSV
--tsv Output TSV
--no-headers Omit CSV headers
--no-headers Omit headers from CSV/TSV and table/--fmt output
-t, --table Output as a formatted table
--fmt TEXT Table format - one of asciidoc, colon_grid,
double_grid, double_outline, fancy_grid,
@ -184,7 +184,7 @@ See :ref:`cli_memory`.
--arrays Output rows as arrays instead of objects
--csv Output CSV
--tsv Output TSV
--no-headers Omit CSV headers
--no-headers Omit headers from CSV/TSV and table/--fmt output
-t, --table Output as a formatted table
--fmt TEXT Table format - one of asciidoc, colon_grid,
double_grid, double_outline, fancy_grid,
@ -423,7 +423,7 @@ See :ref:`cli_search`.
--arrays Output rows as arrays instead of objects
--csv Output CSV
--tsv Output TSV
--no-headers Omit CSV headers
--no-headers Omit headers from CSV/TSV and table/--fmt output
-t, --table Output as a formatted table
--fmt TEXT Table format - one of asciidoc, colon_grid,
double_grid, double_outline, fancy_grid, fancy_outline,
@ -689,7 +689,7 @@ See :ref:`cli_tables`.
--arrays Output rows as arrays instead of objects
--csv Output CSV
--tsv Output TSV
--no-headers Omit CSV headers
--no-headers Omit headers from CSV/TSV and table/--fmt output
-t, --table Output as a formatted table
--fmt TEXT Table format - one of asciidoc, colon_grid,
double_grid, double_outline, fancy_grid, fancy_outline,
@ -731,7 +731,7 @@ See :ref:`cli_views`.
--arrays Output rows as arrays instead of objects
--csv Output CSV
--tsv Output TSV
--no-headers Omit CSV headers
--no-headers Omit headers from CSV/TSV and table/--fmt output
-t, --table Output as a formatted table
--fmt TEXT Table format - one of asciidoc, colon_grid,
double_grid, double_outline, fancy_grid, fancy_outline,
@ -778,7 +778,7 @@ See :ref:`cli_rows`.
--arrays Output rows as arrays instead of objects
--csv Output CSV
--tsv Output TSV
--no-headers Omit CSV headers
--no-headers Omit headers from CSV/TSV and table/--fmt output
-t, --table Output as a formatted table
--fmt TEXT Table format - one of asciidoc, colon_grid,
double_grid, double_outline, fancy_grid,
@ -818,7 +818,7 @@ See :ref:`cli_triggers`.
--arrays Output rows as arrays instead of objects
--csv Output CSV
--tsv Output TSV
--no-headers Omit CSV headers
--no-headers Omit headers from CSV/TSV and table/--fmt output
-t, --table Output as a formatted table
--fmt TEXT Table format - one of asciidoc, colon_grid,
double_grid, double_outline, fancy_grid, fancy_outline,
@ -858,7 +858,7 @@ See :ref:`cli_indexes`.
--arrays Output rows as arrays instead of objects
--csv Output CSV
--tsv Output TSV
--no-headers Omit CSV headers
--no-headers Omit headers from CSV/TSV and table/--fmt output
-t, --table Output as a formatted table
--fmt TEXT Table format - one of asciidoc, colon_grid,
double_grid, double_outline, fancy_grid, fancy_outline,