mirror of
https://github.com/pcvolkmer/osc-variant.git
synced 2025-07-03 01:02:55 +00:00
Add 'compact' option to get smaller output files
This commit is contained in:
@ -39,9 +39,11 @@ pub enum Command {
|
||||
#[command(about = "Modifiziert die angegebene Datei anhand der Profildatei")]
|
||||
Modify {
|
||||
inputfile: String,
|
||||
#[arg(long = "profile", help = "Profildatei (Optional)")]
|
||||
#[arg(long = "profile", help = "Profildatei (optional)")]
|
||||
profile: Option<String>,
|
||||
#[arg(long = "output", help = "Ausgabedatei (Optional)")]
|
||||
#[arg(long = "output", help = "Ausgabedatei (optional)")]
|
||||
outputfile: Option<String>,
|
||||
#[arg(long = "compact", help = "Kompakte Ausgabe, ohne Einrücken (Optional)")]
|
||||
compact: bool,
|
||||
},
|
||||
}
|
||||
|
@ -117,6 +117,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
inputfile,
|
||||
profile,
|
||||
outputfile,
|
||||
compact,
|
||||
} => {
|
||||
let data = &mut read_inputfile(inputfile)?;
|
||||
|
||||
@ -130,7 +131,9 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
let mut buf = String::new();
|
||||
|
||||
let mut serializer = Serializer::new(&mut buf);
|
||||
serializer.indent(' ', 2);
|
||||
if !compact {
|
||||
serializer.indent(' ', 2);
|
||||
}
|
||||
|
||||
data.serialize(serializer).expect("Generated XML");
|
||||
|
||||
|
Reference in New Issue
Block a user