Refactor context creation to a builder pattern

This mainly refactors context creation to use a builder pattern.  It
also adds a logdir option to this builder patter but doesn't yet use
this.
This commit is contained in:
Floris Bruynooghe
2019-11-06 17:17:44 +01:00
parent dacde72456
commit f8736895cd
6 changed files with 133 additions and 40 deletions

View File

@@ -366,11 +366,12 @@ fn main_0(args: Vec<String>) -> Result<(), failure::Error> {
println!("Error: Bad arguments, expected [db-name].");
return Err(format_err!("No db-name specified"));
}
let context = Context::new(
let context = ContextBuilder::new(
Box::new(receive_event),
"CLI".into(),
Path::new(&args[1]).to_path_buf(),
)?;
)
.create()?;
println!("Delta Chat Core is awaiting your commands.");