Adds a way to clean either all or only .svg
This commit is contained in:
parent
53d8ab77dd
commit
945ec489c5
|
|
@ -32,6 +32,10 @@ pub(super) struct GraphConfig {
|
|||
/// Alternative config to load (generate a new one with init)
|
||||
#[arg(short, long)]
|
||||
config: Option<String>,
|
||||
|
||||
/// Clean all the artefacts (including generated images)
|
||||
#[arg(short, long)]
|
||||
all: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
@ -82,18 +86,21 @@ fn load_graph_config(args: &GraphConfig) -> Result<MiniTheme> {
|
|||
}
|
||||
}
|
||||
/// Delete the existing graphs
|
||||
fn del_graphs(_args: &GraphConfig) -> Result<()> {
|
||||
fn del_graphs(args: &GraphConfig) -> Result<()> {
|
||||
let mut cmd = Command::new("rm");
|
||||
cmd.args(
|
||||
glob("Images/Radar/*.svg")?
|
||||
.map(|v| v.unwrap().to_str().unwrap().to_string())
|
||||
.collect::<Vec<String>>(),
|
||||
);
|
||||
cmd.args(
|
||||
glob("Images/Radar/*.png")?
|
||||
.map(|v| v.unwrap().to_str().unwrap().to_string())
|
||||
.collect::<Vec<String>>(),
|
||||
);
|
||||
|
||||
if args.all {
|
||||
cmd.args(
|
||||
glob("Images/Radar/*.png")?
|
||||
.map(|v| v.unwrap().to_str().unwrap().to_string())
|
||||
.collect::<Vec<String>>(),
|
||||
);
|
||||
}
|
||||
|
||||
if let Err(e) = cmd.output() {
|
||||
println!(
|
||||
|
|
@ -231,7 +238,7 @@ static STR_TO_GRAPH_TARGET_TYPE: phf::Map<&'static str, GraphTargetType> = phf_m
|
|||
"generate" => GraphTargetType::Generate,
|
||||
"gen" => GraphTargetType::Generate,
|
||||
"remove" => GraphTargetType::Remove,
|
||||
"del" => GraphTargetType::Remove,
|
||||
"clean" => GraphTargetType::Remove,
|
||||
"init" => GraphTargetType::Init,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue