diff --git a/src/client.rs b/src/client.rs index 167ea70..1e33ab5 100644 --- a/src/client.rs +++ b/src/client.rs @@ -93,6 +93,41 @@ pub struct AppendOptions<'a> { pub date: Option>, } +/// A builder for the append command +#[derive(Default)] +pub struct AppendCmd<'a> { + flags: Vec<&'a Flag<'a>>, + date: Option>, +} + +impl<'a> AppendCmd<'a> { + /// Create a new AppendCmd builder + pub fn create() -> Self { + Self::default() + } + + /// Append a flag + pub fn flag(&mut self, flag: &'a Flag<'a>) -> &mut Self { + self.flags.push(flag); + self + } + + /// Set the internal date + pub fn internal_date(&mut self, date: DateTime) -> &mut Self { + self.date = Some(date); + self + } +} + +impl<'a> Into> for AppendCmd<'a> { + fn into(self) -> AppendOptions<'a> { + AppendOptions { + flags: Some(&self.flags[..]), + date: self.date, + } + } +} + // `Deref` instances are so we can make use of the same underlying primitives in `Client` and // `Session` impl Deref for Client {