sharkdp/bat

Determine CSV delimiter based on header

Opened this issue · 2 comments

Would it be possible to determine the CSV delimiter based on the first line of the file?

I have a usecase where I store floats using a comma , as a decimal separator, which conflicts with the syntax highlighter.

Eg. the file

foo;bar;baz
1,2;1,7;2,7
1,5;8,5;-5,5

Renders as follows
image

As the header only contains one of the four accepted delimiters ;, would it not be safe to assume that any other character is not the delimiter?

Thanks for reporting. We had a look at ways to fix this previously, but never got round to finalizing it. #2078 (comment)
If you're up to creating a PR, it would be well received :)

Maybe I will look into it, although I don't currently have a great idea on how to achieve the desired result...