Reformat code
This commit is contained in:
parent
91875dd607
commit
775cb0ca4e
@ -7,18 +7,22 @@ use std::path::Path;
|
||||
fn main() {
|
||||
let out_dir = env::var_os("TRUNK_STAGING_DIR").unwrap_or("target".into());
|
||||
|
||||
create_config("session_config", &out_dir, &SessionConfig {
|
||||
motd: "Proben Dienstags um 18:30 Uhr und Sonntags um 10:00 Uhr".to_string(),
|
||||
})
|
||||
create_config(
|
||||
"session_config",
|
||||
&out_dir,
|
||||
&SessionConfig {
|
||||
motd: "Proben Dienstags um 18:30 Uhr und Sonntags um 10:00 Uhr".to_string(),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
fn create_config<T, P>(name: &str, out_dir: P, default_config: &T)
|
||||
where
|
||||
T: Serialize,
|
||||
P: AsRef<Path>,
|
||||
where
|
||||
T: Serialize,
|
||||
P: AsRef<Path>,
|
||||
{
|
||||
//TODO return, if config already exists and is up to date
|
||||
let out_path = out_dir.as_ref().join(format!("{name}.json"));
|
||||
let out_file = File::create(&out_path).unwrap();
|
||||
serde_json::to_writer_pretty(out_file, default_config).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user