diff --git a/pttodoest/src/main.rs b/pttodoest/src/main.rs index 001167a..9f4e818 100755 --- a/pttodoest/src/main.rs +++ b/pttodoest/src/main.rs @@ -111,8 +111,18 @@ mod test_flags { } } -fn add(files: Vec, add: String, add_schedule: Option) -> Result<(), String> { - Err("not impl".to_string()) +fn add(files: Vec, added: String, add_schedule: Option) -> Result<(), String> { + let task = match add_schedule.clone() { + None => serde_yaml::Value::String(added), + Some(add_schedule) => { + let mut m = serde_yaml::Mapping::new(); + m.insert("schedule".into(), add_schedule.into()); + m.insert("do".into(), added.into()); + serde_yaml::Value::Mapping(m) + } + }; + + panic!("append {:?} to {:?}", &task, &files); } fn reconcile(files: Vec) -> Result<(), String> {