mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 09:54:31 +02:00
--fmt now implies --table, closes #374
This commit is contained in:
parent
148e9c7aee
commit
b8c134059e
3 changed files with 26 additions and 14 deletions
|
|
@ -81,7 +81,6 @@ def output_options(fn):
|
|||
help="Table format - one of {}".format(
|
||||
", ".join(tabulate.tabulate_formats)
|
||||
),
|
||||
default="simple",
|
||||
),
|
||||
click.option(
|
||||
"--json-cols",
|
||||
|
|
@ -192,8 +191,8 @@ def tables(
|
|||
row.append(db[name].schema)
|
||||
yield row
|
||||
|
||||
if table:
|
||||
print(tabulate.tabulate(_iter(), headers=headers, tablefmt=fmt))
|
||||
if table or fmt:
|
||||
print(tabulate.tabulate(_iter(), headers=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:
|
||||
|
|
@ -1456,8 +1455,12 @@ def _execute_query(
|
|||
sys.stdout.buffer.write(data)
|
||||
else:
|
||||
sys.stdout.write(str(data))
|
||||
elif table:
|
||||
print(tabulate.tabulate(list(cursor), headers=headers, tablefmt=fmt))
|
||||
elif fmt or table:
|
||||
print(
|
||||
tabulate.tabulate(
|
||||
list(cursor), headers=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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue