From b5979d2e0a1d4e0868ba7679d4c5768fff3441ea Mon Sep 17 00:00:00 2001 From: Luis Date: Mon, 10 Jul 2023 23:05:27 +0200 Subject: [PATCH] allow to change CSV separator #14 --- src/htmltab/cli.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/htmltab/cli.py b/src/htmltab/cli.py index 0e1a9fe..483f0e3 100644 --- a/src/htmltab/cli.py +++ b/src/htmltab/cli.py @@ -63,6 +63,11 @@ "strings. Use multiple times if you have more than one " "currency symbol [default: '{}']".format("', '".join(DEFAULT_CURRENCY_SYMBOLS)), ) +@click.option( + "--sep", + type=str, + default=",", + help="set CSV separator [default ',']",) @click.option( "--output", "-o", @@ -74,6 +79,7 @@ @click.version_option() def main( select, + sep, null_value, convert_numbers, group_symbol, @@ -216,7 +222,7 @@ def main( rows.append(row) # Output the CSV to stdout. - output = csv.writer(output) + output = csv.writer(output, delimiter=sep) for row in rows: # Extra empty cells are added to the row as required, to ensure that # all rows have the same number of fields (as required by the closest