diff --git a/src/delete.rs b/src/delete.rs index 99f30dde52e47e9b4dcc6cc47859efad7711a5be..f2633b7532dc22fd4eb722d9bf2bbdcf411b0ed9 100644 --- a/src/delete.rs +++ b/src/delete.rs @@ -5,7 +5,7 @@ use std::{ process::{exit, Command, Stdio}, }; -use crate::commit; +use crate::{commit, prune}; #[derive(Debug, Args)] pub(crate) struct Delete { /// Do not change the repository @@ -87,7 +87,7 @@ pub(crate) struct Delete { help_heading = "Archive filters", display_order = 4 )] - pub(crate) first: Option<isize>, + pub(crate) first: Option<usize>, /// consider last N archives after other filters were applied #[clap( long, @@ -95,7 +95,7 @@ pub(crate) struct Delete { help_heading = "Archive filters", display_order = 5 )] - pub(crate) last: Option<isize>, + pub(crate) last: Option<usize>, /// Name of archives to delete #[clap( help_heading = "Positional Arguments", @@ -159,20 +159,11 @@ fn handle_force_arguments(margs: &mut Vec<String>, sd: &Delete) { /// A boolean indicating if Archive filters are used. Also Update `margs` parameter fn handle_arguments_value(margs: &mut Vec<String>, sd: &Delete) -> bool { let va: HM<&str, String> = HM::from([ - ("--prefix", sd.prefix.clone().unwrap_or(String::from(""))), - ( - "--glob-archives", - sd.glob_archives.clone().unwrap_or(String::from("")), - ), - ("--sort-by", sd.sort_by.clone().unwrap_or(String::from(""))), - ( - "--first", - sd.first.unwrap_or(-1).to_string().replace("-1", ""), - ), - ( - "--last", - sd.last.unwrap_or(-1).to_string().replace("-1", ""), - ), + ("--prefix", prune::get_str(&sd.prefix)), + ("--glob-archives", prune::get_str(&sd.glob_archives)), + ("--sort-by", prune::get_str(&sd.sort_by)), + ("--first", prune::string_convert(sd.first)), + ("--last", prune::string_convert(sd.last)), ]); let mut count = 0; for (name, value) in va {