feat: add --output-format/-o tabular/csv/yaml/json arg#2
Conversation
Maximkaaa
left a comment
There was a problem hiding this comment.
Looks good. And this time it doesn't panic! :-)
Just a few comments to make output look cleaner.
| OutputFormat::Csv => { | ||
| let mut writer = CsvWriter::from_writer(stdout()); | ||
| csv_output::write_csv_header_row(&mut writer); | ||
| csv_output::write_single_csv_value(root_dir, stats, &mut writer); |
There was a problem hiding this comment.
This makes output of CSV for single and multiple files differ. For single it prints out "." as a path, and for multiple "Main". I think a better output would have "Total" in both cases, and in multi-file case make in the last line, not firstl. This would look like a proper spreadsheet.
There was a problem hiding this comment.
I've replaced the first column of the totals CSV output with the file count.
|
Also, please, add some information about this into readme. |
|
Great points, should be addressed now, thanks for your patience and keen eye in examining the output! 😄 |
Maximkaaa
left a comment
There was a problem hiding this comment.
Looks good now, just one thing. CSV output has an extra empty line at the end of the output.
Also, I've configured release-plz, so that we can easily release the updated version so, please, rebase on main.
Signed-off-by: Nashwan Azhari <aznashwan@icloud.com>
This patch adds support for selecting the output format using the `--output-format/-o` arg. Options include CSV, Json, YAML, as well as the pre-existing Tabular format. Signed-off-by: Nashwan Azhari <aznashwan@icloud.com>
Signed-off-by: Nashwan Azhari <aznashwan@icloud.com>
Signed-off-by: Nashwan Azhari <aznashwan@icloud.com>
3833b4d to
299f74f
Compare
This patch adds support for selecting the output format using the
--output-format/-oarg.Options include CSV, Json, YAML, as well as the pre-existing Tabular
format.
I've included some tests to ensure that the output serialization doesn't panic this time 🤣
That being said, I did not feel the need to add explicit tests on the output values/fields to avoid making adding fields a chore (except for the CSV implementation, which sadly inevitably requires some glue code).
Thanks again for making this crate!