Skip to content
Snippets Groups Projects
Verified Commit 3f650098 authored by nfontrod's avatar nfontrod
Browse files

src/delete.rs: handle_arguments_value function uses prune::get_str & prune::string_convert function

parent b708ae81
No related branches found
No related tags found
No related merge requests found
......@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment