| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
`--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>
|
Friendly ping — same as #750, the full test suite is waiting on a maintainer CI approval (only the docs checks have run). This makes --fmt and --table output honor --no-headers. Happy to make changes once CI runs. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Refs #566.
Problem
--no-headers was only honored for --csv/--tsv output. For the tabulate formats (--fmt ... and -t/--table) the flag was silently ignored, so the column-name header row was always printed:
The two tabulate.tabulate(...) call sites (the query/memory output and the rows/tables output) always passed headers=headers regardless of the flag.
Fix
Both call sites now pass headers=() if no_headers else headers. tabulate renders headerless output cleanly for every format (plain, simple, github, grid, rst, …), so --no-headers now works consistently across CSV, TSV and all --fmt/--table formats. Default output (headers shown) is unchanged, and the CSV/TSV path is untouched.
I went with making the flag do what its name says (rather than raising an error on --fmt + --no-headers) because tabulate supports headerless rendering for all formats and this matches the documented purpose of the flag — and the use case in the issue (piping a single column into xargs/unix tools) is a legitimate one.
The --no-headers help text previously said "Omit CSV headers"; it now reads "Omit headers from CSV/TSV and table/--fmt output", and docs/cli-reference.rst is regenerated via cog to match.
Tests
Added test_output_table_no_headers, parametrized over --fmt simple, -t and --fmt github, asserting the header row is omitted (and the data preserved) for both the query and rows commands.
📚 Documentation preview 📚: https://sqlite-utils--751.org.readthedocs.build/en/751/