Statement-Converter/project/src/main.rs

50 lines
1.1 KiB
Rust
Raw Normal View History

2025-04-18 14:12:29 -05:00
// Libraries
mod action;
mod args;
mod parser;
mod reader;
mod writer;
2025-04-18 14:12:29 -05:00
use args::Arguments;
use parser::Parser;
use reader::Reader;
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();
// 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();
// 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();
// 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
}