| Crates.io | csvargs |
| lib.rs | csvargs |
| version | 0.3.1 |
| created_at | 2025-07-20 03:14:42.051017+00 |
| updated_at | 2025-07-20 03:14:42.051017+00 |
| description | A command-line tool for processing CSV files with Jinja2 templates and executing commands on each row. |
| homepage | https://github.com/rickprice/csvargs |
| repository | https://github.com/rickprice/csvargs |
| max_upload_size | |
| id | 1760734 |
| size | 36,438 |
A command-line tool for processing CSV files with Jinja2 templates and executing commands on each row.
csvargs allows you to read CSV files, apply Jinja2 templates to each row, and execute the resulting commands. This is useful for batch processing tasks where you need to run commands based on data in CSV files.
Make sure you have Rust installed, then build from source:
cargo build --release
The binary will be available at target/release/csvargs.
csvargs [OPTIONS] <TEMPLATE> <FILES>...
TEMPLATE: Jinja2 template string for generating commandsFILES: One or more CSV files to process--no-header: Treat CSV files as having no header row (data starts from first row)Given a CSV file users.csv:
name,email,age
Alice,alice@example.com,25
Bob,bob@example.com,30
Execute commands using column names:
csvargs "echo 'Hello {{row.name}}, your email is {{row.email}}'" users.csv
Given a CSV file data.csv:
Alice,alice@example.com,25
Bob,bob@example.com,30
Execute commands using column indices:
csvargs --no-header "echo 'Hello {{row['0']}}, your email is {{row['1']}}'" data.csv
Create directories based on CSV data:
csvargs "mkdir -p /tmp/users/{{row.name}} && echo 'Created directory for {{row.name}}'" users.csv
Process multiple CSV files at once:
csvargs "echo 'Processing {{row.name}}'" file1.csv file2.csv file3.csv
csvargs uses Jinja2 templating. The CSV row data is available as the row variable:
{{row.column_name}}{{row['0']}}, {{row['1']}}, etc.Run the test suite:
cargo test
BSD 3-Clause License - see LICENSE file for details.