use super::funejson::Value; use super::todo_import_csv_validate_todo_csv::read_todo_csv; use super::todo_item::{todos_to_value, Todo}; /// Todos from CSV: the 13 columns in any order, CRLF or LF, an optional /// byte order mark. Every row is checked with validate_todo. /// /// # Panics /// With "row N: ..." (the header is row 1) on the first malformed or invalid /// row, or on a header without exactly the 13 columns. validate_todo_csv /// lists every problem instead. pub fn import_csv(csv: &str) -> Vec { let reading = read_todo_csv(csv); if let Some(first) = reading.problems.first() { panic!("{}", first.thrown); } reading.todos } pub fn fune_vector(args: &[Value]) -> Value { todos_to_value(&import_csv(args[0].as_str())) }