A file-based task manager

Add options for querying body, not implemented

+20 -5
+12 -3
src/main.rs
··· 162 Commands::Edit { task_id } => command_edit(dir, task_id), 163 Commands::Completion { shell } => command_completion(shell), 164 Commands::Drop => command_drop(dir), 165 - Commands::Find { full_id, .. } => command_find(dir, full_id), 166 Commands::Rot => Workspace::from_path(dir).unwrap().rot(), 167 Commands::Tor => Workspace::from_path(dir).unwrap().tor(), 168 Commands::Reprioritize { task_id } => command_reprioritize(dir, task_id), ··· 267 Ok(()) 268 } 269 270 - fn command_find(dir: PathBuf, full_id: bool) -> Result<()> { 271 - let id = Workspace::from_path(dir)?.search(None)?; 272 if let Some(id) = id { 273 if full_id { 274 println!("{id}");
··· 162 Commands::Edit { task_id } => command_edit(dir, task_id), 163 Commands::Completion { shell } => command_completion(shell), 164 Commands::Drop => command_drop(dir), 165 + Commands::Find { 166 + full_id, 167 + search_body, 168 + search_archived, 169 + } => command_find(dir, full_id, search_body, search_archived), 170 Commands::Rot => Workspace::from_path(dir).unwrap().rot(), 171 Commands::Tor => Workspace::from_path(dir).unwrap().tor(), 172 Commands::Reprioritize { task_id } => command_reprioritize(dir, task_id), ··· 271 Ok(()) 272 } 273 274 + fn command_find( 275 + dir: PathBuf, 276 + full_id: bool, 277 + search_body: bool, 278 + search_archived: bool, 279 + ) -> Result<()> { 280 + let id = Workspace::from_path(dir)?.search(None, search_body, search_archived)?; 281 if let Some(id) = id { 282 if full_id { 283 println!("{id}");
+8 -2
src/workspace.rs
··· 66 67 impl Workspace { 68 pub fn init(path: PathBuf) -> Result<()> { 69 let tsk_dir = path.join(".tsk"); 70 if tsk_dir.exists() { 71 return Err(Error::AlreadyInitialized); ··· 97 let stack_item = stack.get(r as usize).ok_or(Error::NoTasks)?; 98 Ok(stack_item.id) 99 } 100 - TaskIdentifier::Find => self.search(None)?.ok_or(Error::NotSelected), 101 } 102 } 103 ··· 224 } 225 } 226 227 - pub fn search(&self, stack: Option<TaskStack>) -> Result<Option<Id>> { 228 let stack = if let Some(stack) = stack { 229 stack 230 } else {
··· 66 67 impl Workspace { 68 pub fn init(path: PathBuf) -> Result<()> { 69 + // TODO: detect if in a git repo and add .tsk/ to `.git/info/exclude` 70 let tsk_dir = path.join(".tsk"); 71 if tsk_dir.exists() { 72 return Err(Error::AlreadyInitialized); ··· 98 let stack_item = stack.get(r as usize).ok_or(Error::NoTasks)?; 99 Ok(stack_item.id) 100 } 101 + TaskIdentifier::Find => self.search(None, false, false)?.ok_or(Error::NotSelected), 102 } 103 } 104 ··· 225 } 226 } 227 228 + pub fn search( 229 + &self, 230 + stack: Option<TaskStack>, 231 + _search_body: bool, 232 + _include_archived: bool, 233 + ) -> Result<Option<Id>> { 234 let stack = if let Some(stack) = stack { 235 stack 236 } else {