csv_converter/
lib.rs

1//! ```skip
2//!  █▀▀ █▀▀ █ █   █▀▀ █▀█ █▄ █ █ █ █▀▀ █▀█ ▀█▀ █▀▀ █▀█
3//!  █▄▄ ▄▄█ ▀▄▀   █▄▄ █▄█ █ ▀█ ▀▄▀ ██▄ █▀▄  █  ██▄ █▀▄
4//! ```
5//! A tool to convert a CSV file into a new format
6//!
7//! `csv_converter` is a Rust-based CLI application designed to convert CSV files into a format compatible with
8//! [Matrixify](https://matrixify.app/), a powerful import/export app for Shopify stores.
9//! This tool streamlines the process of preparing bulk data for Shopify, making it easier to manage large inventories.
10//!
11//! ```rust
12//! use csv_converter::{
13//!     Settings,
14//!     OutputConfig,
15//!     CsvParser,
16//!     process,
17//!     export,
18//! };
19//! use std::{io::BufReader, fs::File};
20//!
21//! let file = BufReader::new(File::open("tests/config.csv").unwrap());
22//! let reader = BufReader::new(file);
23//! let config_file = CsvParser::new(reader);
24//! let output_config = OutputConfig::new(config_file);
25//!
26//! let mut is_heading = true;
27//! let mut output = String::new();
28//! let reader = BufReader::new(File::open("tests/input.csv").unwrap());
29//! let mut csv_file = CsvParser::new(reader);
30//! while let Some(row) = csv_file.next() {
31//!     if is_heading {
32//!         is_heading = false;
33//!         output = format!("{}\n", output_config.heading);
34//!     } else {
35//!         export(&process::run(&row, &output_config), &mut output);
36//!     };
37//!     // output is a String with the new content in the format and can now be written to the output file
38//! }
39//! ```
40
41pub mod cli;
42pub mod config;
43pub mod csv;
44pub mod process;
45
46pub use cli::*;
47pub use config::*;
48pub use csv::*;
49pub use process::*;