mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 09:24:31 +02:00
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5f81752cf5
commit
d516e58543
3 changed files with 67 additions and 11 deletions
|
|
@ -111,7 +111,11 @@ def output_options(fn):
|
|||
),
|
||||
click.option("--csv", is_flag=True, help="Output CSV"),
|
||||
click.option("--tsv", is_flag=True, help="Output TSV"),
|
||||
click.option("--no-headers", is_flag=True, help="Omit CSV headers"),
|
||||
click.option(
|
||||
"--no-headers",
|
||||
is_flag=True,
|
||||
help="Omit headers from CSV/TSV and table/--fmt output",
|
||||
),
|
||||
click.option(
|
||||
"-t", "--table", is_flag=True, help="Output as a formatted table"
|
||||
),
|
||||
|
|
@ -240,7 +244,13 @@ def tables(
|
|||
yield row
|
||||
|
||||
if table or fmt:
|
||||
print(tabulate.tabulate(_iter(), headers=headers, tablefmt=fmt or "simple"))
|
||||
print(
|
||||
tabulate.tabulate(
|
||||
_iter(),
|
||||
headers=() if no_headers else headers,
|
||||
tablefmt=fmt or "simple",
|
||||
)
|
||||
)
|
||||
elif csv or tsv:
|
||||
writer = csv_std.writer(sys.stdout, dialect="excel-tab" if tsv else "excel")
|
||||
if not no_headers:
|
||||
|
|
@ -2145,7 +2155,9 @@ def _execute_query(
|
|||
elif fmt or table:
|
||||
print(
|
||||
tabulate.tabulate(
|
||||
list(cursor), headers=headers, tablefmt=fmt or "simple"
|
||||
list(cursor),
|
||||
headers=() if no_headers else headers,
|
||||
tablefmt=fmt or "simple",
|
||||
)
|
||||
)
|
||||
elif csv or tsv:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue