mirror of
https://github.com/sharkdp/bat.git
synced 2025-10-30 06:33:59 +00:00
Correctly handle CSV files with a single separator throughout
better auto-detection of CSV delimiter - files with a tsv extension are automatically detected as tab delimited - other files parsed as CSV go through the following steps: - if the first line contains at least 3 of the same separator, it uses that separator as a delimiter - if the first line contains only one supported separator character, it uses that separator as a delimiter - otherwise it falls back to treating all supported delimiters as the delimiter supported delimiters, in precedence order: - comma `,` - semi-colon `;` - tab `\t` - pipe `|`
This commit is contained in:
3
tests/syntax-tests/highlighted/CSV/simple.tsv
vendored
Normal file
3
tests/syntax-tests/highlighted/CSV/simple.tsv
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[3;38;2;253;151;31mfoo[0m[38;2;253;151;31m [0m[38;2;102;217;239mbar[0m[38;2;253;151;31m [0m[38;2;190;132;255mbaz|;,[0m[38;2;253;151;31m [0m[38;2;249;38;114mtest[0m[38;2;253;151;31m [0m[38;2;230;219;116mhello world[0m[38;2;253;151;31m [0m[3;38;2;253;151;31mtsv[0m
|
||||
[3;38;2;253;151;31m1,2[0m[38;2;253;151;31m [0m[38;2;102;217;239m1,7[0m[38;2;253;151;31m [0m[38;2;190;132;255m2,7[0m[38;2;253;151;31m [0m[38;2;249;38;114ma b c[0m[38;2;253;151;31m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mhello again[0m[38;2;230;219;116m"[0m[38;2;253;151;31m [0m[3;38;2;253;151;31mtsv[0m
|
||||
[3;38;2;230;219;116m"[0m[3;38;2;230;219;116m;|,[0m[3;38;2;230;219;116m"[0m[38;2;253;151;31m [0m[38;2;102;217;239m;|,[0m[38;2;253;151;31m [0m[38;2;190;132;255mbaz[0m[38;2;253;151;31m [0m[38;2;249;38;114mtest[0m[38;2;253;151;31m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mhello world[0m[38;2;230;219;116m"[0m[38;2;253;151;31m [0m[3;38;2;253;151;31mtsv[0m
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 218.
|
Reference in New Issue
Block a user