Added Writer w/ Console Messages to Log

This commit is contained in:
Maddox Werts 2025-04-18 16:18:15 -04:00
parent bf7edc2f97
commit 1fdb88f3a8

View file

@ -3,10 +3,12 @@ mod action;
mod args; mod args;
mod parser; mod parser;
mod reader; mod reader;
mod writer;
use args::Arguments; use args::Arguments;
use parser::Parser; use parser::Parser;
use reader::Reader; use reader::Reader;
use writer::Writer;
use std::io::Result; use std::io::Result;
@ -15,14 +17,33 @@ fn main() -> Result<()> {
// Reading the Arguments // Reading the Arguments
let args = Arguments::new(); let args = Arguments::new();
// Display Status
println!("Reading PDF and extracting Text Content...");
// Creating a File Reader & Reading // Creating a File Reader & Reading
let reader = Reader::new(&args.file_input.clone())?; let reader = Reader::new(&args.file_input.clone())?;
let text = reader.extract(); let text = reader.extract();
// Display Status
println!("Successfully extracted Text Content!");
println!("Parsing the PDF...");
// Creating a Parser to read the Text Content // Creating a Parser to read the Text Content
let mut parser = Parser::new(text); let mut parser = Parser::new(text);
parser.start(); parser.start();
// 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!");
// It's ok! // It's ok!
Ok(()) Ok(())
} }