mirror of
https://github.com/pcvolkmer/osc-variant.git
synced 2025-04-19 11:46:50 +00:00
Add 'compact' option to get smaller output files
This commit is contained in:
parent
aa610a0593
commit
ea135010d2
@ -34,6 +34,11 @@ Ohne Profildatei wird die Datei lediglich eingelesen, Leerzeichen am Ende eines
|
||||
|
||||
Ohne eine Angabe der Ausgabedatei wird auf die Standardausgabe ausgegeben.
|
||||
|
||||
#### Kompakte Ausgabe
|
||||
|
||||
OSC-Dateien sind XML-Dateien. Diese Anwendung ermöglicht optional die Ausgabe als kompaktere XML-Datei ohne Zeilenumbrüche.
|
||||
Hierzu ist die Option `--compact` vorgesehen. Es können, je nach Datei, bis zu 30% eingespart werden.
|
||||
|
||||
## Profile
|
||||
|
||||
Zum Erstellen von Varianten einer OSC-Datei wird eine Profildatei im YAML-Format verwendet.
|
||||
@ -72,4 +77,4 @@ Wird sie angeben, sind die Felder `name`, `position` und `column` verpflichtend.
|
||||
Es können beliebig viele Formulare mit beliebig vielen Änderungen zu Formularverweisen in einer Profildatei
|
||||
hinterlegt werden, jedoch ist mindestens eine Angabe zu einem Formularfeld erforderlich.
|
||||
|
||||
Beispiele für eine Profildatei sind unter [`examples/`](examples/) zu finden.
|
||||
Beispiele für eine Profildatei sind unter [`examples/`](examples/) zu finden.
|
||||
|
@ -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");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user