Issue #10: Add interactive mode

This commit is contained in:
2023-10-04 10:14:45 +02:00
parent f456e278cb
commit afb5a2e17a
4 changed files with 237 additions and 10 deletions

View File

@@ -33,6 +33,7 @@ use std::str::FromStr;
use clap::Parser;
use console::style;
use dialoguer::Confirm;
use quick_xml::se::Serializer;
use serde::Serialize;
use sha256::digest;
@@ -149,6 +150,7 @@ fn main() -> Result<(), Box<dyn Error>> {
compact,
sorted,
strip,
interactive,
} => {
let data = &mut read_inputfile(inputfile)?;
@@ -159,6 +161,32 @@ fn main() -> Result<(), Box<dyn Error>> {
data.apply_profile(&profile);
}
let mut compact = compact;
let mut sorted = sorted;
let mut strip = strip;
if interactive {
compact = Confirm::new()
.with_prompt("Kompakte Ausgabe, ohne Einrücken?")
.default(compact)
.interact()
.unwrap();
sorted = Confirm::new()
.with_prompt("Sortiere Kataloge und Formulare nach Name und Abhängigkeiten?")
.default(sorted)
.interact()
.unwrap();
strip = Confirm::new()
.with_prompt(
"Entferne Einträge aus der Systembibliothek die nicht importiert werden?",
)
.default(strip)
.interact()
.unwrap();
}
if sorted {
data.sorted();
}