jblondin / csv-sniffer

CSV sniffer crate for Rust
MIT License
7 stars 1 forks source link

Feature request: display field name along with inferred type #12

Open jqnatividad opened 2 years ago

jqnatividad commented 2 years ago

Right now, it only displays the column number, e.g.

$ cargo run .\tests\data\library-visitors.csv
Metadata
========
Dialect:
        Delimiter: ,
        Has header row?: true
        Number of preamble rows: 0
        Quote character: none
        Flexible: false

Number of fields: 5
Types:
        0: Text
        1: Unsigned
        2: Unsigned
        3: Unsigned
        4: Unsigned

It'd be great if it did something like this instead:

$ cargo run .\tests\data\library-visitors.csv
Metadata
========
Dialect:
        Delimiter: ,
        Has header row?: true
        Number of preamble rows: 0
        Quote character: none
        Flexible: false

Number of fields: 5
Types:
        1 Month:               Text
        2 Door Count:          Unsigned
        3 Web Site Visits:     Unsigned
        4 Catalog Visits:      Unsigned
        5 Overdrive Visits:    Unsigned

Note how the field count is still there but not zero-based, and the tabstops are still automagically aligned with elastic-tabstops using tabwriter.