use anyhow::Result;
#[derive(Debug, Clone)]
pub struct Task {
pub description: String,
pub goal: String,
}
pub struct Interpreter;
impl Interpreter {
pub fn new() -> Self {
Self
}
pub fn interpret(&self, input: &str) -> Result<Task> {
let goal = if input.contains("create") || input.contains("build") {
format!("Create or build: {}", input)
} else if input.contains("fix") || input.contains("debug") {
format!("Fix or debug: {}", input)
} else if input.contains("test") {
format!("Test: {}", input)
} else {
format!("Complete task: {}", input)
};
Ok(Task {
description: input.to_string(),
goal,
})
}
}