[yabridgectl] Add a way to clear entire blacklist

This commit is contained in:
Robbert van der Helm
2021-04-14 19:25:07 +02:00
parent 7ff4bb1585
commit 6765abb6e5
2 changed files with 12 additions and 0 deletions
@@ -43,3 +43,9 @@ pub fn list_paths(config: &Config) -> Result<()> {
Ok(())
}
/// Clear the entire blacklist.
pub fn clear(config: &mut Config) -> Result<()> {
config.blacklist.clear();
config.write()
}
+6
View File
@@ -216,6 +216,11 @@ fn main() -> Result<()> {
App::new("list")
.about("List the blacklisted paths")
.display_order(3),
)
.subcommand(
App::new("clear")
.about("Clear the entire blacklist")
.display_order(4),
),
)
.get_matches();
@@ -272,6 +277,7 @@ fn main() -> Result<()> {
&options.value_of_t_or_exit::<PathBuf>("path"),
),
Some(("list", _)) => actions::blacklist::list_paths(&config),
Some(("clear", _)) => actions::blacklist::clear(&mut config),
_ => unreachable!(),
},
_ => unreachable!(),