diff --git a/cli/src/argparse/subcommand.rs b/cli/src/argparse/subcommand.rs index 22c270ba3..553350740 100644 --- a/cli/src/argparse/subcommand.rs +++ b/cli/src/argparse/subcommand.rs @@ -218,6 +218,7 @@ impl Modify { "start" => modification.active = Some(true), "stop" => modification.active = Some(false), "done" => modification.status = Some(Status::Completed), + "delete" => modification.status = Some(Status::Deleted), "annotate" => { // what would be parsed as a description is, here, used as the annotation if let DescriptionMod::Set(s) = modification.description { @@ -243,6 +244,7 @@ impl Modify { arg_matching(literal("start")), arg_matching(literal("stop")), arg_matching(literal("done")), + arg_matching(literal("delete")), arg_matching(literal("annotate")), )), Modification::parse, @@ -297,10 +299,19 @@ impl Modify { Mark all tasks matching the required filter as completed, additionally applying any given modifications.", }); + u.subcommands.push(usage::Subcommand { + name: "delete", + syntax: " delete [modification]", + summary: "Mark tasks as deleted", + description: " + Mark all tasks matching the required filter as deleted, additionally applying any given + modifications. Deleted tasks remain until they are expired in a 'ta gc' operation at + least six months after their last modification.", + }); u.subcommands.push(usage::Subcommand { name: "annotate", syntax: " annotate [modification]", - summary: "Mark tasks as completed", + summary: "Annotate a task", description: " Add an annotation to all tasks matching the required filter.", }); @@ -761,6 +772,23 @@ mod test { ); } + #[test] + fn test_delete() { + let subcommand = Subcommand::Modify { + filter: Filter { + conditions: vec![Condition::IdList(vec![TaskId::WorkingSetId(123)])], + }, + modification: Modification { + status: Some(Status::Deleted), + ..Default::default() + }, + }; + assert_eq!( + Subcommand::parse(argv!["123", "delete"]).unwrap(), + (&EMPTY[..], subcommand) + ); + } + #[test] fn test_annotate() { let subcommand = Subcommand::Modify {