use std::convert::TryFrom; use std::io::Write; use clap::ArgMatches; use chrono::{DateTime, Utc}; use regex::Regex; use crate::database::{Database, DBVersion}; use crate::error::{Error, Result}; use crate::commands::Command; use crate::config::Config; use crate::timeparse::parse_time; use crate::old::{entries_or_warning, time_or_warning, warn_if_needed}; use crate::formatters::text; use crate::editor; use crate::regex::parse_regex; #[derive(Default)] pub struct Args { start: Option>, end: Option>, grep: Option, fake: bool, sheet: Option, } impl<'a> TryFrom<&'a ArgMatches<'a>> for Args { type Error = Error; fn try_from(matches: &'a ArgMatches) -> Result { Ok(Args { start: matches.value_of("start").map(|s| parse_time(s)).transpose()?, end: matches.value_of("end").map(|s| parse_time(s)).transpose()?, grep: matches.value_of("grep").map(parse_regex).transpose()?, fake: matches.is_present("fake"), sheet: matches.value_of("sheet").map(|s| s.to_owned()), }) } } pub struct ArchiveCommand {} impl<'a> Command<'a> for ArchiveCommand { type Args = Args; fn handle(args: Args, db: &mut D, out: &mut O, err: &mut E, config: &Config, now: DateTime) -> Result<()> where D: Database, O: Write, E: Write, { unimplemented!() } }