2025-04-18 14:12:29 -05:00
|
|
|
// Libraries
|
|
|
|
|
mod action;
|
|
|
|
|
mod args;
|
|
|
|
|
mod parser;
|
|
|
|
|
mod reader;
|
2025-04-18 15:18:15 -05:00
|
|
|
mod writer;
|
2025-04-18 14:12:29 -05:00
|
|
|
|
|
|
|
|
use args::Arguments;
|
|
|
|
|
use parser::Parser;
|
|
|
|
|
use reader::Reader;
|
2025-04-18 15:18:15 -05:00
|
|
|
use writer::Writer;
|
2025-04-18 14:12:29 -05:00
|
|
|
|
|
|
|
|
use std::io::Result;
|
|
|
|
|
|
|
|
|
|
// Entry-Point
|
|
|
|
|
fn main() -> Result<()> {
|
|
|
|
|
// Reading the Arguments
|
|
|
|
|
let args = Arguments::new();
|
|
|
|
|
|
2025-04-18 15:18:15 -05:00
|
|
|
// Display Status
|
|
|
|
|
println!("Reading PDF and extracting Text Content...");
|
|
|
|
|
|
2025-04-18 14:12:29 -05:00
|
|
|
// Creating a File Reader & Reading
|
|
|
|
|
let reader = Reader::new(&args.file_input.clone())?;
|
|
|
|
|
let text = reader.extract();
|
|
|
|
|
|
2025-04-18 15:18:15 -05:00
|
|
|
// Display Status
|
|
|
|
|
println!("Successfully extracted Text Content!");
|
|
|
|
|
println!("Parsing the PDF...");
|
|
|
|
|
|
2025-04-18 14:12:29 -05:00
|
|
|
// Creating a Parser to read the Text Content
|
|
|
|
|
let mut parser = Parser::new(text);
|
|
|
|
|
parser.start();
|
|
|
|
|
|
2025-04-18 15:18:15 -05:00
|
|
|
// Display Status
|
|
|
|
|
println!("Successfully parsed the PDF!");
|
|
|
|
|
println!("Saving to a CSV File...");
|
|
|
|
|
|
|
|
|
|
// Creating a Writer and saving the file
|
|
|
|
|
let writer = Writer::new(&parser.transactions, args.file_output.clone());
|
|
|
|
|
writer.save()?;
|
|
|
|
|
|
|
|
|
|
// Display Status
|
|
|
|
|
println!("Sucessfully Saved to {}", args.file_output);
|
|
|
|
|
println!("Thank you for using Statement Converter!");
|
|
|
|
|
|
2025-04-18 14:12:29 -05:00
|
|
|
// It's ok!
|
|
|
|
|
Ok(())
|
2025-04-18 13:04:48 -05:00
|
|
|
}
|