Wrap options for yabridgectl sync/set in a struct

To prevent having to pass a bunch of confusing boolean values or an
entire ArgMatch object.
This commit is contained in:
Robbert van der Helm
2020-07-19 13:35:45 +02:00
parent 527c90c18d
commit 9580dbea12
2 changed files with 36 additions and 22 deletions
+13 -3
View File
@@ -124,11 +124,21 @@ fn main() -> Result<()> {
}
("list", _) => actions::list_directories(&config),
("status", _) => actions::show_status(&config),
("set", Some(options)) => actions::set_settings(&mut config, options),
("set", Some(options)) => actions::set_settings(
&mut config,
&actions::SetOptions {
method: options.value_of("method"),
// We've already verified that the path is valid, so we should only be getting
// errors for missing arguments
path: options.value_of_t("path").ok(),
},
),
("sync", Some(options)) => actions::do_sync(
&config,
options.is_present("prune"),
options.is_present("verbose"),
&actions::SyncOptions {
prune: options.is_present("prune"),
verbose: options.is_present("verbose"),
},
),
_ => unreachable!(),
}