Statement-Converter/project/src/args.rs
OBJNULL 92a666d9bc Add core modules for statement parsing and CLI args
Includes initial implementations for action, args, parser, and reader
modules, supporting PDF reading and argument parsing.
2025-04-18 15:12:34 -04:00

50 lines
1.4 KiB
Rust

// Libraries
use clap::{Arg, ArgAction, Command};
// Structures
pub struct Arguments {
pub file_input: String,
pub file_output: String,
}
// Implementations
impl Arguments {
// Constructors
pub fn new() -> Self {
// Creating an Application
let matches = Command::new("statement-converter")
.about("A service that converts Bank Statement PDF files into CSV files")
.version("1.0.0")
.arg_required_else_help(true)
/*
PDF Path
*/
.arg(
Arg::new("file_in")
.short('i')
.long("file_in")
.help("The PDF you want to convert")
.action(ArgAction::Set)
.required(true),
)
.arg(
Arg::new("file_out")
.short('o')
.long("file_out")
.help("The CSV Path you want to save to")
.action(ArgAction::Set)
.required(true),
)
.get_matches();
// Getting the required arguments
let file_input = matches.get_one::<String>("file_in").unwrap().to_string();
let file_output = matches.get_one::<String>("file_out").unwrap().to_string();
// Returning a Result
Self {
file_input,
file_output,
}
}
}