mirror of
				https://github.com/pcvolkmer/osc-variant.git
				synced 2025-10-31 08:16:12 +00:00 
			
		
		
		
	Add 'compact' option to get smaller output files
This commit is contained in:
		| @@ -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. | 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 | ## Profile | ||||||
|  |  | ||||||
| Zum Erstellen von Varianten einer OSC-Datei wird eine Profildatei im YAML-Format verwendet. | Zum Erstellen von Varianten einer OSC-Datei wird eine Profildatei im YAML-Format verwendet. | ||||||
|   | |||||||
| @@ -39,9 +39,11 @@ pub enum Command { | |||||||
|     #[command(about = "Modifiziert die angegebene Datei anhand der Profildatei")] |     #[command(about = "Modifiziert die angegebene Datei anhand der Profildatei")] | ||||||
|     Modify { |     Modify { | ||||||
|         inputfile: String, |         inputfile: String, | ||||||
|         #[arg(long = "profile", help = "Profildatei (Optional)")] |         #[arg(long = "profile", help = "Profildatei (optional)")] | ||||||
|         profile: Option<String>, |         profile: Option<String>, | ||||||
|         #[arg(long = "output", help = "Ausgabedatei (Optional)")] |         #[arg(long = "output", help = "Ausgabedatei (optional)")] | ||||||
|         outputfile: Option<String>, |         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, |             inputfile, | ||||||
|             profile, |             profile, | ||||||
|             outputfile, |             outputfile, | ||||||
|  |             compact, | ||||||
|         } => { |         } => { | ||||||
|             let data = &mut read_inputfile(inputfile)?; |             let data = &mut read_inputfile(inputfile)?; | ||||||
|  |  | ||||||
| @@ -130,7 +131,9 @@ fn main() -> Result<(), Box<dyn Error>> { | |||||||
|             let mut buf = String::new(); |             let mut buf = String::new(); | ||||||
|  |  | ||||||
|             let mut serializer = Serializer::new(&mut buf); |             let mut serializer = Serializer::new(&mut buf); | ||||||
|  |             if !compact { | ||||||
|                 serializer.indent(' ', 2); |                 serializer.indent(' ', 2); | ||||||
|  |             } | ||||||
|  |  | ||||||
|             data.serialize(serializer).expect("Generated XML"); |             data.serialize(serializer).expect("Generated XML"); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user