Support add_snapshots on cli
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
use crate::settings::Settings;
|
||||
use taskchampion::{server::Server, Replica};
|
||||
use termcolor::WriteColor;
|
||||
|
||||
pub(crate) fn execute<W: WriteColor>(
|
||||
w: &mut W,
|
||||
replica: &mut Replica,
|
||||
settings: &Settings,
|
||||
server: &mut Box<dyn Server>,
|
||||
) -> Result<(), crate::Error> {
|
||||
// TODO: configurable avoid_snapshots
|
||||
replica.sync(server, false)?;
|
||||
replica.sync(server, settings.avoid_snapshots)?;
|
||||
writeln!(w, "sync complete.")?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -25,9 +26,10 @@ mod test {
|
||||
let mut replica = test_replica();
|
||||
let server_dir = TempDir::new().unwrap();
|
||||
let mut server = test_server(&server_dir);
|
||||
let settings = Settings::default();
|
||||
|
||||
// Note that the details of the actual sync are tested thoroughly in the taskchampion crate
|
||||
execute(&mut w, &mut replica, &mut server).unwrap();
|
||||
execute(&mut w, &mut replica, &settings, &mut server).unwrap();
|
||||
assert_eq!(&w.into_string(), "sync complete.\n")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ pub(crate) fn invoke(command: Command, settings: Settings) -> Result<(), crate::
|
||||
..
|
||||
} => {
|
||||
let mut server = get_server(&settings)?;
|
||||
return cmd::sync::execute(&mut w, &mut replica, &mut server);
|
||||
return cmd::sync::execute(&mut w, &mut replica, &settings, &mut server);
|
||||
}
|
||||
|
||||
// handled in the first match, but here to ensure this match is exhaustive
|
||||
|
||||
Reference in New Issue
Block a user