diff --git a/src/bin/installer.rs b/src/bin/installer.rs index c04d7cc294b989c2fe4300204dad126d08b4fe0a..19adcd3c7ce6f957ec6a40e5109de6312f4c936b 100644 --- a/src/bin/installer.rs +++ b/src/bin/installer.rs @@ -18,6 +18,7 @@ fn main() { let mut parser = ArgParser::new(4) .add_opt("b", "cookbook") .add_opt("c", "config") + .add_opt("o", "output-config") .add_flag(&["filesystem-size"]) .add_flag(&["r", "repo-binary"]) .add_flag(&["l", "list-packages"]) @@ -40,10 +41,19 @@ fn main() { redox_installer::Config::default() }; + // Get toml of merged config + let merged_toml = toml::to_string_pretty(&config).unwrap(); + + // Just output merged config and exit + if let Some(path) = parser.get_opt("output-config") { + fs::write(path, merged_toml).unwrap(); + return; + } + // Add filesystem.toml to config config.files.push(redox_installer::FileConfig { path: "filesystem.toml".to_string(), - data: toml::to_string_pretty(&config).unwrap(), + data: merged_toml, ..Default::default() });