From 98242044d9e26b87a3d782f430058bd61435df1f Mon Sep 17 00:00:00 2001 From: Justin Wernick Date: Mon, 20 Mar 2023 14:20:20 +0200 Subject: Update dependencies --- src/main.rs | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 03bcff3..37644c0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,38 +1,29 @@ pub mod qif; +use clap::Parser; use qif::*; use std::{ error::Error, - ffi::{OsStr, OsString}, fs::File, io::{prelude::*, *}, path::PathBuf, result::Result, }; -use structopt::StructOpt; -fn parse_filepath(str: &OsStr) -> Result { - let path: PathBuf = ::std::convert::From::from(str); - if path.is_file() { - Ok(path) - } else { - Err(str.to_os_string()) - } -} - -#[derive(StructOpt, Debug)] +/// Qif file preprocessor to decrease duplication when importing to gnucash +#[derive(Parser, Debug)] #[structopt( name = "Qif Parser", - about = "Qif file preprocessor to decrease duplication when importing to gnucash" + version, about, long_about = None )] struct CliArgs { /// Files to preprocess - #[structopt(parse(try_from_os_str = parse_filepath))] + #[arg(value_hint = clap::ValueHint::FilePath)] files: Vec, } fn main() -> Result<(), Box> { - let args = CliArgs::from_args(); + let args = CliArgs::parse(); for filepath in &args.files { let file = File::open(filepath)?; -- cgit v1.2.3