Switch to a command-line API closer to TaskWarrior
* Use a parser (rather than clap) to process the command line * Outline some generic support for filtering, reporting, modifying, etc. * Break argument parsing strictly from invocation, to allow independent testing
This commit is contained in:
21
cli/src/invocation/cmd/gc.rs
Normal file
21
cli/src/invocation/cmd/gc.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use failure::Fallible;
|
||||
use taskchampion::Replica;
|
||||
|
||||
pub(crate) fn execute(replica: &mut Replica) -> Fallible<()> {
|
||||
replica.gc()?;
|
||||
println!("garbage collected.");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::invocation::cmd::test::test_replica;
|
||||
|
||||
#[test]
|
||||
fn test_gc() {
|
||||
let mut replica = test_replica();
|
||||
execute(&mut replica).unwrap();
|
||||
// this mostly just needs to not fail!
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user