Skip to content

Commit

Permalink
underped cli logic
Browse files Browse the repository at this point in the history
  • Loading branch information
epi052 committed Nov 25, 2023
1 parent 2051424 commit ab9a3b0
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions src/config/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,36 +841,19 @@ impl Configuration {
|| came_from_cli!(args, "thorough")
{
config.collect_backups = true;

println!("{:?}", came_from_cli!(args, "collect_backups"));
config.backup_extensions = backup_extensions();

if came_from_cli!(args, "collect_backups") {
if let Some(arg) = args.get_many::<String>("collect_backups") {
let mut backup_exts = Vec::<String>::new();

for ext in arg {
println!("pushing {} to backup_extensions (was {})", ext.trim(), ext);
backup_exts.push(ext.trim().to_string());
}
let backup_exts = arg
.map(|ext| ext.trim().to_string())
.collect::<Vec<String>>();

if backup_exts.is_empty() {
config.backup_extensions = backup_extensions();
println!(
"no backup extensions specified, using defaults: {:?}",
backup_extensions()
);
} else {
if !backup_exts.is_empty() {
// have at least one cli backup, override the defaults
config.backup_extensions = backup_exts;

Check warning on line 854 in src/config/container.rs

View check run for this annotation

Codecov / codecov/patch

src/config/container.rs#L853-L854

Added lines #L853 - L854 were not covered by tests
}
} else {
config.backup_extensions = backup_extensions();
println!(
"no backup extensions specified, using defaults: {:?}",
backup_extensions()
);
}

Check warning on line 856 in src/config/container.rs

View check run for this annotation

Codecov / codecov/patch

src/config/container.rs#L856

Added line #L856 was not covered by tests
} else {
config.backup_extensions = backup_extensions();
}
}

Expand Down

0 comments on commit ab9a3b0

Please sign in to comment.