From c6bd5614cb7a1453ddd1862ad17fb693c87f2e82 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Thu, 23 May 2024 15:33:31 +0200 Subject: --export-csv-dialec: add excel-lf (excel with LF rather than CRLF) --- lib/cli.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/cli.py') diff --git a/lib/cli.py b/lib/cli.py index 297944b..36371f1 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -361,6 +361,16 @@ def export_dot(model, dot_prefix): def export_csv_unparam(model, csv_prefix, dialect="excel"): import csv + class ExcelLF(csv.Dialect): + delimiter = "," + quotechar = '"' + doublequote = True + skipinitialspace = False + lineterminator = "\n" + quoting = 0 + + csv.register_dialect("excel-lf", ExcelLF) + for name in sorted(model.names): filename = f"{csv_prefix}{name}.csv" with open(filename, "w") as f: @@ -482,7 +492,7 @@ def add_standard_arguments(parser): "--export-csv-dialect", metavar="DIALECT", type=str, - choices=["excel", "excel-tab", "unix"], + choices=["excel", "excel-lf", "excel-tab", "unix"], default="excel", help="CSV dialect to use for --export-csv-unparam", ) -- cgit v1.2.3