mirror of
https://github.com/pcvolkmer/osc-variant.git
synced 2025-07-03 01:02:55 +00:00
Issue #10: Add interactive mode
This commit is contained in:
@ -78,7 +78,7 @@ pub enum SubCommand {
|
||||
#[arg(
|
||||
long = "sorted",
|
||||
alias = "x-sorted",
|
||||
help = "Sortiere Kataloge und Formulare nach Name (Optional)."
|
||||
help = "Sortiere Kataloge und Formulare nach Name und Abhängigkeiten (Optional)."
|
||||
)]
|
||||
sorted: bool,
|
||||
#[arg(
|
||||
@ -87,6 +87,12 @@ pub enum SubCommand {
|
||||
help = "Entferne Einträge aus der Systembibliothek die nicht importiert werden (Optional)."
|
||||
)]
|
||||
strip: bool,
|
||||
#[arg(
|
||||
short = 'i',
|
||||
long = "interactive",
|
||||
help = "Starte interaktiven Dialog zum Modifizieren von OSC-Dateien"
|
||||
)]
|
||||
interactive: bool,
|
||||
},
|
||||
#[command(about = "Vergleiche zwei Dateien anhand der Revision der enthaltenen Inhalte")]
|
||||
Diff {
|
||||
|
28
src/main.rs
28
src/main.rs
@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user