// 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::("file_in").unwrap().to_string(); let file_output = matches.get_one::("file_out").unwrap().to_string(); // Returning a Result Self { file_input, file_output, } } }