summaryrefslogtreecommitdiff
path: root/lib/cli.py
diff options
context:
space:
mode:
authorBirte Kristina Friesel <birte.friesel@uos.de>2024-05-23 15:33:31 +0200
committerBirte Kristina Friesel <birte.friesel@uos.de>2024-05-23 15:33:31 +0200
commitc6bd5614cb7a1453ddd1862ad17fb693c87f2e82 (patch)
treea521e3569f543d408be9fb538bdc5faf10ebca18 /lib/cli.py
parent0c09f3486fa4db0e2f4f5ee415b846107cceace6 (diff)
--export-csv-dialec: add excel-lf (excel with LF rather than CRLF)
Diffstat (limited to 'lib/cli.py')
-rw-r--r--lib/cli.py12
1 files changed, 11 insertions, 1 deletions
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",
)