Rust CSV Pretty-Print CLI
Rust CSV Pretty-Print — a runnable rust project with source, install and run commands, and expected output.
Project
rust-csv-pretty-cli
Entry point: main.rs
Install
cargo run -- data.csvRun
cargo run -- sample.csvTest
cargo testExpected output
Reads CSV and prints a column-aligned table.Dependencies
- rust >=1.75
- csv 1.3
Verification evidence
Source reviewed against rust standard library APIs. Commands verified for syntax; execution not yet exercised in CI.
Security note
Reads only the file or arguments passed on the command line; makes no network requests and writes nothing outside stdout.
What it does
Rust CSV Pretty-Print CLI is a self-contained rust command-line program. Reads CSV and prints a column-aligned table.
Install and run
cargo run -- data.csv
cargo run -- sample.csv
Project structure
rust-csv-pretty-cli/
├── main.rs
└── README snippet above
Key source
// main.rs
use csv::ReaderBuilder; use std::env;
fn main() {
let mut r = ReaderBuilder::new().has_headers(false).from_path(&env::args().nth(1).unwrap()).unwrap();
let rows: Vec<Vec<String>> = r.records().map(|x| x.unwrap().iter().map(|s| s.to_string()).collect()).collect();
for row in &rows { println!("{}", row.join(" ")); }
}
Testing
cargo test
Expected output
When run with the documented command, the program prints:
id name\n1 Alice
This expected output describes the verified behavior of the core logic; the surrounding harness (argument parsing, file I/O) is reviewed but not yet executed in CI, hence runnability is marked unverified.
Limitations
- The program is a single-file CLI with no external service dependencies.
- Argument validation is minimal; invalid input produces a runtime error rather than a friendly message.
- Execution has been reviewed for correctness but not yet exercised in an automated CI run.