YS-L / csvlens

Command line csv viewer
MIT License
2.47k stars 41 forks source link

Feature request: Include padding for sign for columns with positive and negative numbers #80

Open Heeten opened 3 months ago

Heeten commented 3 months ago

I love csvlens, this has been a super helpful tool for my work. I am wondering what you think about this feature request. If I have the following table:

date         a           b 
2019-01-02   -0.002426   -0.002555
2019-01-03   -0.008189   -0.008318
2019-01-04   -0.001163   -0.001294
2019-01-07   0.005784    0.005654
2019-01-08   0.004757    0.004627
2019-01-09   0.000067    -0.000062
2019-01-10   0.000059    -0.000070
2019-01-11   -0.001242   -0.001371
2019-01-14   0.002140    0.002010

I would like if the columns without - had an extra space so it rendered aligned.

YS-L commented 3 months ago

Thanks for the suggestion!

One principle I would like csvlens to follow in general is to not interpret the content of the csv beyond parsing out the fields, and to render the content faithfully. Adding extra spaces requires recognizing a column as numeric with a certain formatting and also modifies the original content, which kind of goes against that principle.

So for now I think it's unlikely that I will prioritize this, but I'm also curious what other users think about this.