Add support for annotations
This matches the taskwarrior task model for annotations.
This commit is contained in:
@@ -39,6 +39,11 @@ pub(crate) fn execute<W: WriteColor>(
|
||||
if let Some(wait) = task.get_wait() {
|
||||
t.add_row(row![b->"Wait", wait]);
|
||||
}
|
||||
let mut annotations: Vec<_> = task.get_annotations().collect();
|
||||
annotations.sort();
|
||||
for ann in annotations {
|
||||
t.add_row(row![b->"Annotation", format!("{}: {}", ann.entry, ann.description)]);
|
||||
}
|
||||
}
|
||||
t.print(w)?;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use crate::argparse::{DescriptionMod, Modification};
|
||||
use taskchampion::TaskMut;
|
||||
use chrono::Utc;
|
||||
use taskchampion::{Annotation, TaskMut};
|
||||
|
||||
/// Apply the given modification
|
||||
pub(super) fn apply_modification(
|
||||
@@ -41,5 +42,12 @@ pub(super) fn apply_modification(
|
||||
task.set_wait(wait)?;
|
||||
}
|
||||
|
||||
if let Some(ref ann) = modification.annotate {
|
||||
task.add_annotation(Annotation {
|
||||
entry: Utc::now(),
|
||||
description: ann.into(),
|
||||
})?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user